Part Number Hot Search : 
DT10C SG352 10010 MB40958 027M0 74LVT 35EIN 64M16
Product Description
Full Text Search
 

To Download SAF-C515-L24N Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  u ser s manual 04.98 c515 8-bit cmos microcontroller h t tp://www .siemens.de/ semiconductor/
edition 04.98 published by siemens ag, bereich halbleiter, marketing- kommunikation, balanstra?e 73, 81541 mnchen ? siemens ag 1998 all rights reserved. attention please! as far as patents or other rights of third parties are concerned, liability is only assumed for components, not for applications, processes and circuits implemented within components or assemblies. the information describes the type of component and shall not be considered as assured characteristics. terms of delivery and rights to change design reserved. for questions on technology, delivery and prices please contact the semiconductor group offices in germany or the siemens companies and representatives worldwide (see address list). due to technical requirements components may contain dangerous substances. for information on the types in question please contact your nearest siemens office, semiconductor group. siemens ag is an approved cecc manufacturer. packing please use the recycling operators known to you. we can also help you C get in touch with your nearest sales office. by agreement we will take packing material back, if it is sorted. you must bear the costs of transport. for packing material that is returned to us unsorted or which we are not obliged to accept, we shall have to invoice you for any costs incurred. components used in life-support devices or systems must be expressly authorized for such purpose! critical components 1 of the semiconductor group of siemens ag, may only be used in life-support devices or systems 2 with the express written approval of the semiconductor group of siemens ag. 1 a critical component is a component used in a life-support device or system whose failure can reasonably be expected to cause the failure of that life-support device or system, or to affect its safety or effectiveness of that device or system. 2 life support devices or systems are intended (a) to be implanted in the human body, or (b) to support and/or maintain and sustain human life. if they fail, it is reasonable to assume that the health of the user may be en- dangered.
c515 users manual revision history : 04.98 previous releases: 08.97 page (new version) page (prev. version) subjects (changes since last revision) 1-2 1-3 1-4, 1-5 1-5 1-6 to 1-10 1-6 2-1 3-4 3-6 4-4 6-65 8-1 8-2 9-1 9-2 10-2, 10-5, 10-6 & 10-8 10-6 10-8 10-13 10-14 10-17 1-2 1-3 1-4 1-4 1-5 to 1-10 1-9 2-1 3-4 3-6 4-4 6-65 8-1 8-2 9-1 9-1 10-2, 10-5, 10-6 & 10-8 10-6 10-8 10-12 10-13 10-16 p-lcc-68 package is inlcuded in the features list pe pin is corrected as pe /swd pin configuration of p-lcc-68 package is included. pe pin is corrected as pe /swd the pin definitions and functions are added for p-lcc-68 package. the pin description is modified in ascending order starting from first pin of p-lcc-68 package the pin name and description is corrected for pe /swd pe pin is corrected as pe /swd in figure 2.1 syscon register description is updated pcon and syscon register descriptions are updated a note is added describing the non availability of ale switch off feature in c515-ln/1rn versions the voltage specifications of v aref and v agnd are changed the description on starting of watchdog timer is modified to include the automatic start by strapping the pin pe /swd to v cc . the content is modified with detailed subheadings. in figure 8-1 pe /swd is added to include the option for the automatic start of watchdog timer a detailed description is added for hardware enable for the use of power saving modes and application example for switching pin pe /swd the description of slow down mode bit (sd) is modified to indicate the availability of this feature for c515-lm/1rm versions only the device specifications are valid for romless versions also. so c515-1rm is modified to c515 in all these pages. clkout timing table for 16 mhz is included clkout timing table for 24 mhz is included timing diagram for clkout timing is included the title rom verification characteristics for the c515-1rm is modified to rom verification characteristics for the c515-1r the package information is added for p-lcc-68 (smd)
general information c515 table of contents page semiconductor group 5 1 introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1 1.1 pin configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-4 1.2 pin definitions and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-6 2 fundamental structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-1 2.1 cpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2 2.2 cpu timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-4 3 memory organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-1 3.1 program memory, "code space" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2 3.2 data memory, "data space" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2 3.3 general purpose registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2 3.4 special function registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-3 4 external bus interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-1 4.1 accessing external memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-1 4.1.1 role of p0 and p2 as data/address bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-1 4.1.2 timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3 4.1.3 external program memory access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3 4.2 psen , program store enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3 4.3 overlapping external data and program memory spaces . . . . . . . . . . . . . . . . . . .4-3 4.4 ale, address latch enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4 4.5 enhanced hooks emulation concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-5 4.6 rom protection for the c515 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-6 4.6.1 unprotected rom mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-6 4.6.2 protected rom mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-7 5 reset and system clock operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-1 5.1 hardware reset operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-1 5.2 hardware reset timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-3 5.3 oscillator and clock circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-4 5.4 system clock output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-6 6 on-chip peripheral components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-1 6.1 parallel i/o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 6.1.1 port structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 -1 6.1.2 standard i/o port circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-3 6.1.2.1 port 0 circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-5 6.1.2.2 port 1, port 3 to port 5 circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-6 6.1.2.3 port 2 circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-7 6.1.2.4 detailed output driver circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-9 6.1.3 port timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6- 11 6.1.4 port loading and interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-12 6.1.5 read-modify-write feature of ports 0 to 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-13 6.2 timers/counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-14 6.2.1 timer/counter 0 and 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-14 6.2.1.1 timer/counter 0 and 1 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-15 6.2.1.2 mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-18 6.2.1.3 mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-19
general information c515 table of contents page semiconductor group 6 6.2.1.4 mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-20 6.2.1.5 mode 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-21 6.2.2 timer/counter 2 with additional compare/capture/reload . . . . . . . . . . . . . . . . .6-22 6.2.2.1 timer 2 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-24 6.2.2.2 timer 2 operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-29 6.2.2.3 compare function of registers crc, cc1 to cc3 . . . . . . . . . . . . . . . . . . . . . . . .6-31 6.2.2.3.1 compare mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-31 6.2.2.3.2 modulation range in compare mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-33 6.2.2.3.3 compare mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-35 6.2.2.4 using interrupts in combination with the compare function . . . . . . . . . . . . . . . .6-37 6.2.2.5 capture function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-39 6.3 serial interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-41 6.3.1 multiprocessor communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-42 6.3.2 serial port registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-42 6.3.3 baud rate generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-44 6.3.3.1 baud rate in mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-45 6.3.3.2 baud rate in mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-45 6.3.3.3 baud rate in mode 1 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-46 6.3.3.3.1 using the baud rate generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-46 6.3.3.3.2 using timer 1 to generate baud rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-46 6.3.4 details about mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-48 6.3.5 details about mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-51 6.3.6 details about modes 2 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-54 6.4 a/d converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-57 6.4.1 a/d converter operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-57 6.4.2 a/d converter registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-59 6.4.2.1 a/d converter control register adcon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-59 6.4.2.2 a/d converter data register addat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-60 6.4.2.3 a/d converter interrupt control bits in ien1 and ircon . . . . . . . . . . . . . . . . . . .6-61 6.4.2.4 programmable reference voltages of the a/d converter (dapr register) . . . . .6-62 6.4.3 a/d conversion timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-66 7 interrupt system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-1 7.1 interrupt registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-4 7.1.1 interrupt enable registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-4 7.1.2 interrupt request / control flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-6 7.1.3 interrupt priority registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-11 7.2 interrupt priority level structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-12 7.3 how interrupts are handled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-13 7.4 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15 7.5 interrupt response time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17 8 fail safe mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1 8.1 watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1 8.1.1 general operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1 8.1.2 starting the watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1 8.1.2.1 the first possibility of starting the watchdog timer . . . . . . . . . . . . . . . . . . . . . . . .8-1
general information c515 table of contents page semiconductor group 7 8.1.2.2 the second possibility of starting the watchdog timer . . . . . . . . . . . . . . . . . . . . .8-1 8.1.3 refreshing the watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2 8.1.4 watchdog reset and watchdog status flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2 8.1.5 wdt control and status flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-3 9 power saving modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-1 9.1 hardware enable for the use of the power saving modes . . . . . . . . . . . . . . . . . . .9-1 9.2 power saving mode control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-2 9.3 idle mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 -3 9.4 slow down mode operation (c515-lm/1rm only) . . . . . . . . . . . . . . . . . . . . . . . . .9-5 9.5 power down mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-6 9.5.1 invoking power down mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-6 9.5.2 exit from power down mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-6 9.6 state of pins in the power saving modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-7 10 device specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-1 10.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-1 10.2 dc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-2 10.3 a/d converter characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-5 10.4 ac characteristics (16 mhz) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-6 10.5 ac characteristics (24 mhz) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-8 10.6 rom verification characteristics for the c515-1r . . . . . . . . . . . . . . . . . . . . . . .10-14 10.7 package information (p-lcc-68) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-17 10.8 package information (p-mqfp-80) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-18 11 index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 -1
semiconductor group 1-1 introduction c515 1 introduction the c515 is a member of the siemens c500 family of 8-bit microcontrollers. lt is functionally fully upward compatible with the sab-80c515/80c535 microcontrollers. the c515 basically operates with internal and/or external program memory. the c515-l is identical to the c515-1r, except that it lacks the on-chip porgram memory. therefore, in this documentation the term c515 refers to all versions within this specification unless otherwise noted. figure 1-1 shows the different functional units of the c515 and figure 1-2 shows the simplified logic symbol of the c515. figure 1-1 c515 functional units mca03198 on-chip emulation support module port 0 port 1 port 2 port 3 ram 256 x 8 cpu t0 t1 usart rom i/o i/o i/o i/o port 6 port 5 port 4 watchdog timer a/d converter i/o i/o analog/ digital input 8-bit k 8x8 power modes saving t2
introduction c515 semiconductor group 1-2 listed below is a summary of the main features of the c515: full upward compatibility with sab 80c515 up to 24 mhz external operating frequency C 500 ns instruction cycle at 24 mhz operation 8k byte on-chip rom (with optional rom protection) C alternatively up to 64k byte external program memory up to 64k byte external data memory 256 byte on-chip ram on-chip emulation support logic (enhanced hooks technology tm ) six 8-bit parallel i/o ports one input port for analog/digital input full duplex serial interface (usart) C 4 operating modes, fixed or variabie baud rates three 16-bit timer/counters C timer 0 / 1 (c501 compatible) C timer 2 for 16-bit reload, compare, or capture functions 8-bit a/d converter C 8 multiplexed analog inputs C programmable reference voltages 16-bit watchdog timer power saving modes C idle mode C slow down mode (can be combined with idle mode) C software power-down mode 12 interrupt sources (7 external, 5 internal) selectable at four priority levels ale switch-off capability (c515-lm/1rm only) p-lcc-68 and p-mqfp-80 packages temperature ranges: sab-c515 t a = 0 to 70 c saf-c515 t a = -40 to 85 c sah-c515 t a = -40 to 110 c (max. operating frequency: 16 mhz)
semiconductor group 1-3 introduction c515 figure 1-2 logic symbol mcl03199 xtal1 xtal2 reset ea ale psen c515 port 0 8 bit digital i/o 1 port port 2 port 3 v ss cc v digital input 6 port port 5 4 port pe/swd 8 bit digital i/o 8 bit digital i/o 8 bit digital i/o 8 bit digital i/o 8 bit digital i/o 8 bit analog/ aref v v agnd
introduction c515 semiconductor group 1-4 1.1 pin configurations this section describes the pin configuration of the c515. figure 1-3 pin configuration of p-lcc-68 package (top view) p5.7 p0.7 p0.5 p0.6 p0.1 p2.6 p2.4 ale psen ea p0.0 p4.4 p4.5 pe/swd p4.3 p5.2 p5.3 p5.5 p5.4 p5.0 p5.1 p4.0 168 9 10 26 27 43 44 60 61 c515-ln/1rn mcp00092 v cc v agnd p2.5 p2.7 p0.4 p2.3 p4.6 p4.7 p5.6 cc v reset p6.7 p6.6 p6.5 p6.4 p6.3 p6.2 p6.1 p6.0 rxd/p3.0 txd/p3.1 int0/p3.2 int1/p3.3 t0/p3.4 wr/p3.6 aref v p4.2 p4.1 p0.2 p0.3 rd/p3.7 t2/p1.7 clkout/p1.6 t2ex/p1.5 int2/p1.4 cc3/int6/p1.3 cc2/int5/p1.2 cc1/int4/p1.1 cc0/int3/p1.0 xtal2 xtal1 p2.0 p2.1 p2.2 ss v t0/p3.4 t1/p3.5
semiconductor group 1-5 introduction c515 figure 1-4 pin configuration of p-mqfp-80-1 package (top view) n.c. pins must not be connected mcp03200 12 n.c. 345 p6.7/ain7 6 p6.6/ain6 7 p6.5/ain5 8 p6.4/ain4 9 p6.3/ain3 10 p6.2/ain2 11 p6.1/ain1 12 p6.0/ain0 13 14 15 p3.0/rxd 16 p3.1/txd 17 p3.2/int0 18 p3.3/int1 19 p3.4/t0 20 p3.5/t1 v agnd 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 p0.7/ad7 p0.6/ad6 p0.5/ad5 p0.4/ad4 p0.3/ad3 p0.2/ad2 p0.1/ad1 p0.0/ad0 ea ale psen p2.7/a15 p2.6/a14 p2.5/a13 p2.4/a12 p2.3/a11 p4.7 p4.6 p4.5 p4.4 p4.3 pe/swd p4.2 p4.1 p4.0 n.c. p5.0 p5.1 p5.2 p5.3 p5.4 p5.5 p3.6/wr p3.7/rd p1.7/t2 p1.6/clkout p1.5/t2ex p1.4/int2 p1.3/int6/cc3 p1.2/int5/cc2 p1.1/int4/cc1 p1.0/int3/cc0 xtal2 xtal1 p2.0/a8 p2.1/a9 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 40 61 p5.6 p5.7 ss v cc v p2.2/a10 aref v reset c515 n.c. v cc n.c. n.c. n.c. n.c. n.c. n.c. n.c. n.c. n.c.
introduction c515 semiconductor group 1-6 1.2 pin definitions and functions this section describes all external signals of the c515 with its function. table 1-1 pin de?nitions and functions symbol pin number p-lcc- 68 pin number p-mqfp- 80 i/o*) function p4.0-p4.7 1-3, 5-9 72-74, 76-80 i/o port 4 is an 8-bit quasi-bidirectional i/o port with internal pull-up resistors. port 4 pins that have 1s written to them are pulled high by the internal pull-up resistors, and in that state can be used as inputs. as inputs, port 4 pins being externally pulled low will source current ( i il , in the dc characteristics) because of the internal pull-up resistors. pe /swd 4 75 i power saving mode enable /start watchdog timer a low level at this pin allows the software to enter the power saving modes(idle mode, slow down mode and power down mode). it is impossible to enter the software controlled power saving modes if this pin is held at high level. a high level during the reset performs an automatic start of watchdog timer immidiately after reset. when left unconnected this pin is pulled high by a weak internal pull-up resistor. reset 10 1 i reset a low level on this pin for the duration of two machine cycles while the oscillator is running resets the c515. a small internal pullup resistor permits power- on reset using only a capacitor connected to v ss . varef 11 3 C reference voltage for the a/d converter vagnd 12 4 C reference ground for the a/d converter p6.0-p6.7 13-20 5-12 i port 6 is an 8-bit unidirectional input port to the a/d converter. port pins can be used for digital input, if voltage levels simultaneously meet the specifications for high/low input voltages and for the eight multiplexed analog inputs. *) i = input o = output
semiconductor group 1-7 introduction c515 p3.0-p3.7 21-28 21 22 23 24 25 26 27 28 15-22 15 16 17 18 19 20 21 22 i/o port 3 is an 8-bit quasi-bidirectional i/o port with internal pullup resistors. port 3 pins that have 1's written to them are pulled high by the internal pullup resistors, and in that state can be used as inputs. as inputs, port 3 pins being externally pulled low will source current ( i il , in the dc characteristics) because of the internal pullup resistors. port 3 also contains the interrupt, timer, serial port and external memory strobe pins that are used by various options. the output latch corresponding to a secondary function must be programmed to a one (1) for that function to operate. the secondary functions are assigned to the pins of port 3 as follows: p3.0 / rxd receiver data input (asynch.) or data input/output (synch.) of serial interface p3.1 / txd transmitter data output (asynch.) or clock output (synch.) of serial interface p3.2 / int0 external interrupt 0 input / timer 0 gate control input p3.3 / int1 external interrupt 1 input / timer 1 gate control input p3.4 / t0 timer 0 counter input p3.5 / t1 timer 1 counter input p3.6 / wr wr control output; latches the data byte from port 0 into the external data memory p3.7 / rd rd control output; enables the external data memory *) i = input o = output table 1-1 pin de?nitions and functions (contd) symbol pin number p-lcc- 68 pin number p-mqfp- 80 i/o*) function
introduction c515 semiconductor group 1-8 p1.0 - p1.7 36-29 36 35 34 33 32 31 30 29 31-24 31 30 29 28 27 26 25 24 i/o port 1 is an 8-bit quasi-bidirectional i/o port with internal pullup resistors. port 1 pins that have 1's written to them are pulled high by the internal pullup resistors, and in that state can be used as inputs. as inputs, port 1 pins being externally pulled low will source current ( i il , in the dc characteristics) because of the internal pullup resistors. the port is used for the low- order address byte during program verification. port 1 also contains the interrupt, timer, clock, capture and compare pins that are used by various options. the output latch corresponding to a secondary function must be programmed to a one (1) for that function to operate (except when used for the compare functions). the secondary functions are assigned to the port 1 pins as follows : p1.0 / int3 / cc0 interrupt 3 input / compare 0 output / capture 0 input p1.1 / int4 / cc1 interrupt 4 input / compare 1 output / capture 1 input p1.2 / int5 / cc2 interrupt 5 input / compare 2 output / capture 2 input p1.3 / int6 / cc3 interrupt 6 input / compare 3 output / capture 3 input p1.4 / int2 interrupt 2 input p1.5 / t2ex timer 2 external reload / trigger input p1.6 / clkout system clock output p1.7 / t2 counter 2 input v ss 38 34 C ground (0 v) v cc 37, 68 33, 69 C supply voltage during normal, idle, and power-down operation. *) i = input o = output table 1-1 pin de?nitions and functions (contd) symbol pin number p-lcc- 68 pin number p-mqfp- 80 i/o*) function
semiconductor group 1-9 introduction c515 xtal2 39 36 C xtal2 input to the inverting oscillator amplifier and input to the internal clock generator circuits. to drive the device from an external clock source, xtal2 should be driven, while xtal1 is left unconnected. minimum and maximum high and low times as well as rise/fall times specified in the ac characteristics must be observed. xtal1 40 37 C xtal1 output of the inverting oscillator amplifier. p2.0-p2.7 41-48 38-45 i/o port 2 is an 8-bit quasi-bidirectional i/o port with internal pullup resistors. port 2 pins that have 1's written to them are pulled high by the internal pullup resistors, and in that state can be used as inputs. as inputs, port 2 pins being externally pulled low will source current ( i il , in the dc characteristics) because of the internal pullup resistors. port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (movx @dptr). in this application it uses strong internal pullup resistors when issuing 1's. during accesses to external data memory that use 8-bit addresses (movx @ri), port 2 issues the contents of the p2 special function register. psen 49 47 o the program store enable output is a control signal that enables the external program memory to the bus during external fetch operations. it is activated every six oscillator periods, except during external data memory accesses. the signal remains high during internal program execution. *) i = input o = output table 1-1 pin de?nitions and functions (contd) symbol pin number p-lcc- 68 pin number p-mqfp- 80 i/o*) function
introduction c515 semiconductor group 1-10 ale 50 48 o the address latch enable output is used for latching the address into external memory during normal operation. it is activated every six oscillator periods, except during an external data memory access. ea 51 49 i external access enable when held high, the c515 executes instructions from the internal rom (c515-1r) as long as the program counter is less than 2000 h . when held low, the c515 fetches all instructions from ext. program memory. for the c515-l this pin must be tied low. p0.0-p0.7 52-59 52-59 i/o port 0 is an 8-bit open-drain bidirectional i/o port. port 0 pins that have 1's written to them float, and in that state can be used as high-impedance inputs. port 0 is also the multiplexed low-order address and data bus during accesses to external program and data memory. in this application it uses strong internal pullup resistors when issuing 1's. port 0 also outputs the code bytes during program verification in the c515-1r. external pullup resistors are required during program verification. p5.?-p5.7 67-60 67-60 i/o port 5 is an 8-bit quasi-bidirectional i/o port with internal pullup resistors. port 5 pins that have 1's written to them are pulled high by the internal pullup resistors, and in that state can be used as inputs. as inputs, port 5 pins being externally pulled low will source current ( i il , in the dc characteristics) because of the internal pullup resistors. n.c. C 2, 13, 14, 23, 32, 35, 46, 50, 51, 68, 70, 71 C not connected these pins of the p-mqfp-80 package must not be connected. *) i = input o = output table 1-1 pin de?nitions and functions (contd) symbol pin number p-lcc- 68 pin number p-mqfp- 80 i/o*) function
semiconductor group 2-1 fundamental structure c515 2 fundamental structure the c515 is fully compatible to the architecture of the standard 8051/c501 microcontroller family. while maintaining all architectural and operational characteristics of the c501, the c515 incorporates a 8-bit a/d converter, a timer 2 with capture/compare functions, as well as some enhancements in the fail save mechanism unit. figure 2-1 shows a block diagram of the c515. figure 2-1 block diagram of the c515 mcb03201 osc & timing cpu timer 0 timer 1 timer 2 s & h 256 x 8 ram rom port 0 port 1 port 2 port 3 port 0 port 1 port 2 xtal2 xtal1 reset ale ea support emulation logic programmable watchdog timer psen pe/swd port 6 port 5 port 4 8 bit digital i/o 8 bit digital i/o 8k x 8 baud rate generator digital input port 5 port 4 port 3 port 6 interrupt unit usart c515 8-bit a/d converter reference voltages programmable v aref agnd v 8 bit digital i/o 8 bit digital i/o 8 bit digital i/o 8 bit digital i/o 8 bit digital i/o analog mux
fundamental structure c515 semiconductor group 2-2 2.1 cpu the c515 is efficient both as a controller and as an arithmetic processor. it has extensive facilities for binary and bcd arithmetic and excels in its bit-handling capabilities. efficient use of program memory results from an instruction set consisting of 44% one-byte, 41% two-byte, and 15% three- byte instructions. with a 12 mhz external clock, 58% of the instructions execute in 1.0 m s ( 24 mhz 500 ns). the cpu (central processing unit) of the c515 consists of the instruction decoder, the arithmetic section and the program control section. each program instruction is decoded by the instruction decoder. this unit generates the internal signals controlling the functions of the individual units within the cpu. they have an effect on the source and destination of data transfers and control the alu processing. the arithmetic section of the processor performs extensive data manipulation and is comprised of the arithmetic/logic unit (alu), an a register, b register and psw register. the alu accepts 8-bit data words from one or two sources and generates an 8-bit result under the control of the instruction decoder. the alu performs the arithmetic operations add, substract, multiply, divide, increment, decrement, bdc-decimal-add-adjust and compare, and the logic operations and, or, exclusive or, complement and rotate (right, left or swap nibble (left four)). also included is a boolean processor performing the bit operations as set, clear, complement, jump- if-not-set, jump-if-set-and-clear and move to/from carry. between any addressable bit (or its complement) and the carry flag, it can perform the bit operations of logical and or logical or with the result returned to the carry flag. the program control section controls the sequence in which the instructions stored in program memory are executed. the 16-bit program counter (pc) holds the address of the next instruction to be executed. the conditional branch logic enables internal and external events to the processor to cause a change in the program execution sequence. accumulator acc is the symbol for the accumulator register. the mnemonics for accumulator-specific instructions, however, refer to the accumulator simply as a. program status word the program status word (psw) contains several status bits that reflect the current state of the cpu.
semiconductor group 2-3 fundamental structure c515 special function register psw (address d0 h ) reset value : 00 h b register the b register is used during multiply and divide and serves as both source and destination. for other instructions it can be treated as another scratch pad register. stack pointer the stack pointer (sp) register is 8 bits wide. it is incremented before data is stored during push and call executions and decremented after data is popped during a pop and ret (reti) execution, i.e. it always points to the last valid stack byte. while the stack may reside anywhere in the on-chip ram, the stack pointer is initialized to 07 h after a reset. this causes the stack to begin a location = 08 h above register bank zero. the sp can be read or written under software control. bit function cy carry flag used by arithmetic instruction. ac auxiliary carry flag used by instructions which execute bcd operations. f0 general purpose flag rs1 rs0 register bank select control bits these bits are used to select one of the four register banks. ov overflow flag used by arithmetic instruction. f1 general purpose flag p parity flag set/cleared by hardware after each instruction to indicate an odd/even number of "one" bits in the accumulator, i.e. even parity. cy ac f0 rs1 rs0 ov f1 p d0 h psw d7 h d6 h d5 h d4 h d3 h d2 h d1 h d0 h bit no. msb lsb rs1 rs0 function 0 0 bank 0 selected, data address 00 h -07 h 0 1 bank 1 selected, data address 08 h -0f h 1 0 bank 2 selected, data address 10 h -17 h 1 1 bank 3 selected, data address 18 h -1f h
fundamental structure c515 semiconductor group 2-4 2.2 cpu timing a machine cycle of the c515 consists of 6 states (12 oscillator periods). each state is devided into a phase 1 half and a phase 2 half. thus, a machine cycle consists of 12 oscillator periods, numbererd s1p1 (state 1, phase 1) through s6p2 (state 6, phase 2). each state lasts for two oscillator periods. typically, arithmetic and logic operations take place during phase 1 and internal register-to-register transfers take place during phase 2. the diagrams in figure 2-2 show the fetch/execute timing related to the internal states and phases. since these internal clock signals are not user-accessible, the xtal1 oscillator signals and the ale (address latch enable) signal are shown for external reference. ale is normally activated twice during each machine cycle: once during s1p2 and s2p1, and again during s4p2 and s5p1. executing of a one-cycle instruction begins at s1p2, when the op-code is latched into the instruction register. if it is a two-byte instruction, the second reading takes place during s4 of the same machine cycle. if it is a one-byte instruction, there is still a fetch at s4, but the byte read (which would be the next op-code) is ignored (discarded fetch), and the program counter is not incremented. in any case, execution is completed at the end of s6p2. figures 2-2 (a) and (b) show the timing of a 1-byte, 1-cycle instruction and for a 2-byte, 1-cycle instruction. most c515 instructions are executed in one cycle. mul (multiply) and div (divide) are the only instructions that take more than two cycles to complete; they take four cycles. normally two code bytes are fetched from the program memory during every machine cycle. the only exception to this is when a movx instruction is executed. movx is a one-byte, 2-cycle instruction that accesses external data memory. during a movx, the two fetches in the second cycle are skipped while the external data memory is being addressed and strobed. figure 2-2 (c) and (d) show the timing for a normal 1-byte, 2-cycle instruction and for a movx instruction.
semiconductor group 2-5 fundamental structure c515 figure 2-2 fetch execute sequence ale mcd03218 s1 s2 s3 s4 s5 s6 s1 s2 s3 s4 s5 s6 p1 p2 p2 p1 p2 p1 p2 p1 p2 p1 p2 p1 p2 p1 p2 p1 p2 p1 p2 p1 p2 p1 p2 p1 osc (xtal1) s1 s2 s3 s4 s5 s6 read opcode opcode (discard) read next a) 1-byte, b) 2-byte, s6 s5 s4 s3 s2 s1 s1 s2 s3 s4 s5 s6 d) movx (1-byte, 2-cycle) c) 1-byte, read next opcode (discard) s6 s5 s4 s3 s2 s1 s1 s2 s3 s4 s5 s6 read 2nd byte opcode read read opcode read next opcode again s6 s5 s4 s3 s2 s1 opcode read (movx) addr data access external memory (discard) read next opcode no fetch no fetch no ale 2-cycle instruction, 1-cycle instruction, e.g. inc dptr e.g. add a, e.g. inc a # data 1-cycle instruction, read next opcode opcode again read next read next opcode again
semiconductor group 3-1 memory organization c515 3 memory organization the c515 cpu manipulates operands in the following four address spaces: C up to 64 kbyte of program memory (8k on-chip program memory for c515-1r) C up to 64 kbyte of external data memory C 256 bytes of internal data memory C a 128 byte special function register area figure 3-1 illustrates the memory address spaces of the c515. figure 3-1 c515 memory map mcd03202 00 h h 7f external ffff h "code space" "data space" "internal data space" h 0000 ram internal internal ram ff h h 80 function special register direct address 80 h h ff address indirect (ea = 0) 1) = (ea internal external h ffff external h 0000 2000 h 1fff h
memory organization c515 semiconductor group 3-2 3.1 program memory, "code space" the c515-1r has 8 kbytes of read-only program memory which can be externally expanded up to 64 kbytes. if the ea pin is held high, the c515-1r executes program code out of the internal rom unless the program counter address exceeds 1fff h . address locations 2000 h through ffff h are then fetched from the external program memory. if the ea pin is held low, the c515 fetches all instructions from the external 64k byte program memory. 3.2 data memory, "data space" the data memory address space consists of an internal and an external memory space. the internal data memory is divided into three physically separate and distinct blocks : the lower 128 bytes of ram, the upper 128 bytes of ram, and the 128 byte special function register (sfr) area. while the upper 128 bytes of data memory and the sfr area share the same address locations, they are accessed through different addressing modes. the lower 128 bytes of data memory can be accessed through direct or register indirect addressing; the upper 128 bytes of ram can be accessed through register indirect addressing; the special function registers are accessible through direct addressing. four 8-register banks, each bank consisting of eight 8-bit general-purpose registers, occupy locations 0 through 1f h in the lower ram area. the next 16 bytes, locations 20 h through 2f h , contain 128 directly addressable bit locations. the stack can be located anywhere in the internal ram area, and the stack depth can be expanded up to 256 bytes. the external data memory can be expanded up to 64 kbyte and can be accessed by instructions that use a 16-bit or an 8-bit address. 3.3 general purpose registers the lower 32 locations of the internal ram are assigned to four banks with eight general purpose registers (gprs) each. only one of these banks may be enabled at a time. two bits in the program status word, rs0 (psw.3) and rs1 (psw.4), select the active register bank (see description of the psw in chapter 2). this allows fast context switching, which is useful when entering subroutines or interrupt service routines. the 8 general purpose registers of the selected register bank may be accessed by register addressing. with register addressing the instruction op code indicates which register is to be used. for indirect addressing r0 and r1 are used as pointer or index register to address internal or external memory (e.g. mov @r0). reset initializes the stack pointer to location 07 h and increments it once to start from location 08 h which is also the first register (r0) of register bank 1. thus, if one is going to use more than one register bank, the sp should be initialized to a different location of the ram which is not used for data storage.
semiconductor group 3-3 memory organization c515 3.5 special function registers the registers, except the program counter and the four general purpose register banks, reside in the special function register area. the 43 special function registers (sfrs) include pointers and registers that provide an interface between the cpu and the other on-chip peripherals. all sfrs with addresses where address bits 0-2 are 0 (e.g. 80 h , 88 h , 90 h , 98 h , ..., f8 h , ff h ) are bitaddressable. the sfrs of the c515 are listed in table 3-1 and table 3-2 . in table 3-1 they are organized in groups which refer to the functional blocks of the c515. table 3-2 illustrates the contents of the sfrs in numeric order of their addresses.
memory organization c515 semiconductor group 3-4 table 3-1 special function registers - functional blocks block symbol name address contents after reset cpu acc b dph dpl psw sp syscon syscon 4) accumulator b-register data pointer, high byte data pointer, low byte program status word register stack pointer system control register system control register e0 h 1) f0 h 1) 83 h 82 h d0 h 1) 81 h b1 h b1 h 00 h 00 h 00 h 00 h 00 h 07 h xx1x xxxx b 3) xxxx xxxx b 3) a/d- converter adcon 2) addat dapr a/d converter control register a/d converter data register a/d converter program register d8 h 1) d9 h da h 00x0 0000 b 3) 00 h 00 h interrupt system ien0 2) ien1 2) p0 2) ip1 ircon tcon 2) t2con 2) scon 2) interrupt enable register 0 interrupt enable register 1 interrupt priority register 0 interrupt priority register 1 interrupt request control register timer control register timer 2 control register serial channel control register a8 h 1) b8 h 1) a9 h b9 h c0 h 1) 88 h 1) c8 h 1) 98 h 1) 00 h 00 h 00 h x000 0000 b 3) xx00 0000 b 3) 00 h 00 h 00 h timer 0/ timer 1 tcon 2) th0 th1 tl0 tl1 tmod timer 0/1 control register timer 0, high byte timer 1, high byte timer 0, low byte timer 1, low byte timer mode register 88 h 1) 8c h 8d h 8a h 8b h 89 h 00 h 00 h 00 h 00 h 00 h 00 h compare/ capture unit / timer 2 ccen cch1 cch2 cch3 ccl1 ccl2 ccl3 crch crcl th2 comp./capture enable reg. comp./capture reg. 1, high byte comp./capture reg. 2, high byte comp./capture reg. 3, high byte comp./capture reg. 1, low byte comp./capture reg. 2, low byte comp./capture reg. 3, low byte com./rel./capt. reg. high byte com./rel./capt. reg. low byte timer 2, high byte c1 h c3 h c5 h c7 h c2 h c4 h c6 h cb h ca h cd h 00 h 00 h 00 h 00 h 00 h 00 h 00 h 00 h 00 h 00 h 1) bit-addressable special function registers 2) this special function register is listed repeatedly since some bits of it also belong to other functional blocks. 3) x means that the value is undefined and the location is reserved 4) for c515-ln/1rn only
semiconductor group 3-5 memory organization c515 ports tl2 t2con 2) p0 p1 p2 p3 p4 p5 p6 timer 2, low byte timer 2 control register port 0 port 1 port 2 port 3 port 4 port 5 port 6, analog/digital input cc h c8 h 1) 80 h 1) 90 h 1) a0 h 1) b0 h 1 e8 h 1) f8 h 1) db h 00 h 00 h ff h ff h ff h ff h ff h ff h C serial channel adcon 2) pcon 2) sbuf scon 2) a/d converter control register power control register serial channel buffer register serial channel control register d8 h 1 87 h 99 h 98 h 1) 00x0 0000 b 3) 00 h xx h 3) 00 h watchdog ien0 2) ien1 2) ip0 2) interrupt enable register 0 interrupt enable register 1 interrupt priority register 0 a8 h 1) b8 h 1) a9 h 00 h 00 h x000 0000 b 3) power saving modes pcon 2) power control register 87 h 00 h 1) bit-addressable special function registers 2) this special function register is listed repeatedly since some bits of it also belong to other functional blocks. 3) x means that the value is undefined and the location is reserved table 3-1 special function registers - functional blocks (contd) block symbol name address contents after reset
memory organization c515 semiconductor group 3-6 table 3-2 contents of the sfrs, sfrs in numeric order of their addresses addr register content after reset 1) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 80 h 2) p0 ff h .7 .6 .5 .4 .3 .2 .1 .0 81 h sp 07 h .7 .6 .5 .4 .3 .2 .1 .0 82 h dpl 00 h .7 .6 .5 .4 .3 .2 .1 .0 83 h dph 00 h .7 .6 .5 .4 .3 .2 .1 .0 87 h pcon 00 h smod pds idls sd gf1 gf0 pde idle 87 h pcon 3) 00 h smod pds idls _ gf1 gf0 pde idle 88 h 2) tcon 00 h tf1 tr1 tf0 tr0 ie1 it1 ie0 it0 89 h tmod 00 h gate c/t m1 m0 gate c/t m1 m0 8a h tl0 00 h .7 .6 .5 .4 .3 .2 .1 .0 8b h tl1 00 h .7 .6 .5 .4 .3 .2 .1 .0 8c h th0 00 h .7 .6 .5 .4 .3 .2 .1 .0 8d h th1 00 h .7 .6 .5 .4 .3 .2 .1 .0 90 h 2) p1 ff h t2 clk- out t2ex int2 int6 int5 int4 int3 98 h 2) scon 00 h sm0 sm1 sm2 ren tb8 rb8 ti ri 99 h sbuf xx h .7 .6 .5 .4 .3 .2 .1 .0 a0 h 2) p2 ff h .7 .6 .5 .4 .3 .2 .1 .0 a8 h 2) ien0 00 h eal wdt et2 es et1 ex1 et0 ex0 a9 h ip0 x000- 0000 b C wdts .5 .4 .3 .2 .1 .0 b0 h 2) p3 ff h rd wr t1 t0 int1 int0 txd rxd b1 h syscon x1xx xxxx b _ _ eale _____ b1 h syscon xxxx xxxx b 4) ________ b8 h 2) ien1 00 h exen2 swdt ex6 ex5 ex4 ex3 ex2 eadc b9 h ip1 xx00- 0000 b C C .5.4.3.2.1.0 1) x means that the value is undefined and the location is reserved 2) bit-addressable special function registers 3) for c515-ln/1rn only 4) this register is available without function in c515-ln/1rn
semiconductor group 3-7 memory organization c515 c0 h 2) ircon 00 h exf2 tf2 iex6 iex5 iex4 iex3 iex2 iadc c1 h ccen 00 h coca h3 cocal 3 coca h2 cocal 2 coca h1 cocal 1 coca h0 cocal 0 c2 h ccl1 00 h .7 .6 .5 .4 .3 .2 .1 .0 c3 h cch1 00 h .7 .6 .5 .4 .3 .2 .1 .0 c4 h ccl2 00 h .7 .6 .5 .4 .3 .2 .1 .0 c5 h cch2 00 h .7 .6 .5 .4 .3 .2 .1 .0 c6 h ccl3 00 h .7 .6 .5 .4 .3 .2 .1 .0 c7 h cch3 00 h .7 .6 .5 .4 .3 .2 .1 .0 c8 h 2) t2con 00 h t2ps i3fr i2fr t2r1 t2r0 t2cm t2i1 t2i0 ca h crcl 00 h .7 .6 .5 .4 .3 .2 .1 .0 cb h crch 00 h .7 .6 .5 .4 .3 .2 .1 .0 cc h tl2 00 h .7 .6 .5 .4 .3 .2 .1 .0 cd h th2 00 h .7 .6 .5 .4 .3 .2 .1 .0 d0 h 2) psw 00 h cy ac f0 rs1 rs0 ov f1 p d8 h 2) adcon 00x0- 0000 b bd clk C bsy adm mx2 mx1 mx0 d9 h addat 00 h .7 .6 .5 .4 .3 .2 .1 .0 da h dapr 00 h .7 .6 .5 .4 .3 .2 .1 .0 db h p6 C .7.6.5.4.3.2.1.0 e0 h 2) acc 00 h .7 .6 .5 .4 .3 .2 .1 .0 e8 h 2) p4 ff h .7 .6 .5 .4 .3 .2 .1 .0 f0 h 2) b 00 h .7 .6 .5 .4 .3 .2 .1 .0 f8 h 2) p5 ff h .7 .6 .5 .4 .3 .2 .1 .0 1) x means that the value is undefined and the location is reserved 2) bit-addressable special function registers table 3-2 contents of the sfrs, sfrs in numeric order of their addresses (contd) addr register content after reset 1) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
semiconductor group 4-1 external bus interface c515 4 external bus interface the c515 allows for external memory expansion. the functionality and implementation of the external bus interface is identical to the common interface for the 8051 architecture with one exception : if the c515 is used in systems with no external memory the generation of the ale signal can be suppressed. resetting bit eale in sfr syscon register, the ale signal will be gated off. this feature reduces rfi emissions of the system. 4.1 accessing external memory it is possible to distinguish between accesses to external program memory and external data memory or other peripheral components respectively. this distinction is made by hardware: accesses to external program memory use the signal psen (program store enable) as a read strobe. accesses to external data memory use rd and wr to strobe the memory (alternate functions of p3.7 and p3.6). port 0 and port 2 (with exceptions) are used to provide data and address signals. in this section only the port 0 and port 2 functions relevant to external memory accesses are described. fetches from external program memory always use a 16-bit address. accesses to external data memory can use either a 16-bit address (movx @dptr) or an 8-bit address (movx @ri). 4.1.1 role of p0 and p2 as data/address bus when used for accessing external memory, port 0 provides the data byte time-multiplexed with the low byte of the address. in this state, port 0 is disconnected from its own port latch, and the address/ data signal drives both fets in the port 0 output buffers. thus, in this application, the port 0 pins are not open-drain outputs and do not require external pullup resistors. during any access to external memory, the cpu writes ff h to the port 0 latch (the special function register), thus obliterating whatever information the port 0 sfr may have been holding. whenever a 16-bit address is used, the high byte of the address comes out on port 2, where it is held for the duration of the read or write cycle. during this time, the port 2 lines are disconnected from the port 2 latch (the special function register). thus the port 2 latch does not have to contain 1s, and the contents of the port 2 sfr are not modified. if an 8-bit address is used (movx @ri), the contents of the port 2 sfr remain at the port 2 pins throughout the external memory cycle. this will facilitate paging. it should be noted that, if a port 2 pin outputs an address bit that is a 1, strong pullups will be used for the entire read/write cycle and not only for two oscillator periods.
semiconductor group 4-2 external bus interface c515 figure 4-1 external program memory execution pcl out pch out one machine cycle one machine cycle in inst. in out pcl pcl out in in out pcl in (a) without movx pcl out valid pcl out valid pcl out valid pcl out valid ale psen rd p2 a) b) p2 rd psen ale valid pcl out valid dpl or ri valid pcl out movx with (b) in pcl out in data in in dph out or p2 out one machine cycle one machine cycle out pcl s6 s5 s4 s3 s2 s1 s6 s5 s4 s3 s2 s1 mct03220 s1 s2 s3 s4 s5 s6 s1 s2 s3 s4 s5 s6 out pch pch out out pch pch out out pch inst. inst. inst. inst. p0 p0 inst. inst. inst.
semiconductor group 4-3 external bus interface c515 4.1.2 timing the timing of the external bus interface, in particular the relationship between the control signals ale, psen , rd , wr and information on port 0 and port 2, is illustated in figure 4-1 a) and b) . data memory : in a write cycle, the data byte to be written appears on port 0 just before wr is activated and remains there until after wr is deactivated. in a read cycle, the incoming byte is accepted at port 0 before the read strobe is deactivated. program memory : signal psen functions as a read strobe. 4.1.3 external program memory access the external program memory is accessed under two conditions: - whenever signal ea is active (low); or - whenever the program counter (pc) content is greater than 1fff h when the cpu is executing out of external program memory, all 8 bits of port 2 are dedicated to an output function and must not be used for general-purpose i/o. the content of the port 2 sfr however is not affected. during external program memory fetches port 2 lines output the high byte of the pc, and during accesses to external data memory they output either dph or the port 2 sfr (depending on whether the external data memory access is a movx @dptr or a movx @ri). since the c515-l has no internal program memory, accesses to program memory are always external, and port 2 is at all times dedicated to output the high-order address byte. this means that port 0 and port 2 of the c515-l can never be used as general-purpose i/o. this also applies to the c515-1r when it operates with only an external program memory. 4.2 psen , program store enable the read strobe for external program memory fetches is psen . it is not activated for internal program memory fetches. when the cpu is accessing external program memory, psen is activated twice every instruction cycle (except during a movx instruction) no matter whether or not the byte fetched is actually needed for the current instruction. when psen is activated its timing is not the same as for rd . a complete rd cycle, including activation and deactivation of ale and rd , takes 6 oscillator periods. a complete psen cycle, including activation and deactivation of ale and psen , takes 3 oscillator periods. the execution sequence for these two types of read cycles is shown in figure 4-1 a) and b) . 4.3 overlapping external data and program memory spaces in some applications it is desirable to execute a program from the same physical memory that is used for storing data. in the c515 the external program and data memory spaces can be combined by the logical-and of psen and rd . a positive result from this and operation produces a low active read strobe that can be used for the combined physical memory. since the psen cycle is faster than the rd cycle, the external memory needs to be fast enough to adapt to the psen cycle.
semiconductor group 4-4 external bus interface c515 4.4 ale, address latch enable the c515 allows to switch off the ale output signal. if the internal rom is used (ea =1 and pc 1fff h ) and ale is switched off by eale=0, then, ale will only go active during external data memory accesses (movx instructions). if ea =0, the ale generation is always enabled and the bit eale has no effect. after a hardware reset the ale generation is enabled. special function register syscon (address b1 h ) reset value : xx1xxxxx b note: the ale swicth-off feature is available in c515-lm/1rm versions only. in case of the c515-ln/1rn versions, the syscon register is present without function. bit function eale enable ale output eale = 0 : ale generation is disabled; disables ale signal generation during internal code memory accesses (ea =1). with ea =1, ale is automatically generated at movx instructions. eale = 1 : ale generation is enabled if ea =0, the ale generation is always enabled and the bit eale has no effect on the ale generation. C reserved bits for future use, read by cpu returns undefined values. 76543210 eale C C b1 h syscon bit no. msb lsb CC CC C
semiconductor group 4-5 external bus interface c515 4.5 enhanced hooks emulation concept the enhanced hooks emulation concept of the c500 microcontroller family is a new, innovative way to control the execution of c500 mcus and to gain extensive information on the internal operation of the controllers. emulation of on-chip rom based programs is possible, too. each c500 production chip has built-in logic for the support of the enhanced hooks emulation concept. therefore, no costly bond-out chips are necessary for emulation. this also ensure that emulation and production chips are identical. the enhanced hooks technology tm 1) , which requires embedded logic in the c500 allows the c500 together with an eh-ic to function similar to a bond-out chip. this simplifies the design and reduces costs of an ice-system. ice-systems using an eh-ic and a compatible c500 are able to emulate all operating modes of the different versions of the c500 microcontrollers. this includes emulation of rom, rom with code rollover and romless modes of operation. it is also able to operate in single step mode and to read the sfrs after a break. figure 4-2 basic c500 mcu enhanced hooks concept configuration port 0, port 2 and some of the control lines of the c500 based mcu are used by enhanced hooks emulation concept to control the operation of the device during emulation and to transfer informations about the program execution and data transfer between the external emulation hardware (ice-system) and the c500 mcu. 1 enhanced hooks technology is a trademark and patent of metalink corporation licensed to siemens. mcs02647 syscon pcon tcon reset ea psen ale port 0 port 2 i/o ports optional port 3 port 1 c500 mcu interface circuit enhanced hooks rport 0 rport 2 rtcon rpcon rsyscon tea tale tpsen eh-ic target system interface ice-system interface to emulation hardware
semiconductor group 4-6 external bus interface c515 4.6 rom protection for the c515 the c515-1r allows to protect the contents of the internal rom against unauthorized read out. the type of rom protection (protected or unprotected) is fixed with the rom mask. therefore, the customer of a c515-1r version has to define whether rom protection has to be selected or not. the c515-1r devices, which operate from internal rom, are always checked for correct rom contents during production test. therefore, unprotected as well as protected roms must provide a procedure to verify the rom contents. in rom verification mode 1, which is used to verify unprotected roms, a rom address is applied externally to the c515-1r and the rom data byte is output at port 0. rom verification mode 2, which is used to verify rom protected devices, operates different : rom addresses are generated internally and the expected data bytes must be applied externally to the device (by the manufacturer or by the customer) and are compared internally with the data bytes from the rom. after 16 byte verify operations the state of the p3.5 pin shows whether the last 16 bytes have been verified correctly. this mechanism provides a very high security of rom protection. only the owner of the rom code and the manufacturer who know the contents of the rom can read out and verify it with less effort. the behaviour of the move code instruction, when the code is executed from the external rom, is in such a way that accessing a code byte from a protected on-chip rom address is not possible. in this case the state of the ea pin is always latched with the rising edge of reset and the byte accessed will be invalid. 4.6.1 unprotected rom mode if the rom is unprotected, the rom verification mode 1 as shown in figure 4-3 is used to read out the contents of the rom. the ac timing characteristics of the rom verification mode is shown in the ac specifications (chapter 10). figure 4-3 rom verification mode 1 rom verification mode 1 is selected if the inputs psen , ale, ea , and reset are put to the specified logic level. then the 14-bit address of the internal rom byte to be read is applied to the port 1 and port 2 lines. after a delay time, port 0 outputs the content of the addressed rom cell. in rom verification mode 1, the c515 must be provided with a system clock at the xtal pins and pullup resistors on the port 0 lines. mct03221 inputs: psen = ss v ale, ea = v ih reset = v il2 address port 0 data p2.0 - p2.4 p1.7 - p1.0 / ih2 v 1 1 out 2 out 2 data address
semiconductor group 4-7 external bus interface c515 4.6.2 protected rom mode if the rom is protected, the rom verification mode 2 as shown in figure 4-4 is used to verify the contents of the rom. the detailed timing characteristics of the rom verification mode is shown in the ac specifications (chapter 10). figure 4-4 rom verification mode 2 rom verification mode 2 is selected if the inputs psen , ea , and ale are put to the specified logic levels. with reset going inactive, the rom verification mode 2 sequence is started. the c515 outputs an ale signal with a period of 3 clp and expects data bytes at port 0. the data bytes at port 0 are assigned to the rom addresses in the following way : 1. data byte = content of internal rom address 0000 h 2. data byte = content of internal rom address 0001 h 3. data byte = content of internal rom address 0002 h : 16. data byte = content of internal rom address 000f h : the c515-1r does not output any address information during the rom verification mode 2. the first data byte to be verified is always the byte which is assigned to the internal rom address 0000 h and is put onto the data bus with the first rising edge of ale. with each following ale pulse the rom address pointer is internally incremented and the expected data byte for the next rom address must be delivered externally. between two ale pulses the data at port 0 is latched (at 3 clp after ale rising edge) and compared internally with the rom content of the actual address. if an verify error is detected, the error mct03222 data for addr. 1 low : error high : ok ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ latch latch latch latch 6 1. ale pulse after reset ~ ~ inputs : ale = ss v psen, ea = v ih reset = reset ale port 0 p3.5 data for addr. x-16-1 addr. x-16 data for data for addr. x-16+1 addr. 0 data for 12 t clcl clcl t
semiconductor group 4-8 external bus interface c515 condition is stored internally. after each 16th data byte the cumulated verify result (pass or fail) of the last 16 verify operations is output at p3.5. this means that p3.5 stays at static level (low for fail and high for pass) during the 16 bytes are checked. in rom verification mode 2, the c515 must be provided with a system clock at the xtal pins. figure 4-5 shows an application example of an external circuitry which allows to verify a protected rom inside the c515-1r in rom verification mode 2. with reset going inactive, the c515-1r starts the rom verify sequence. its ale is clocking a 13-bit address counter. this counter generates the addresses for an external eprom which is programmed with the contents of the internal (protected) rom. the verify detect logic typically displays the pass/fail information of the verify operation. p3.5 can be latched with the falling edge of ale. when the last byte of the internal rom has been handled, the c515-1r starts generating a psen signal. this signal or the cy signal of the address counter indicate to the verify detect logic the end of the internal rom verification. figure 4-5 rom verification mode 2 - external circuitry example mcs03223 & & cc v carry s 2k w a0 cs oe d0 p3.5 ale reset 0 port c515-1r cc v ea psen clk - - a12 d7 logic detect verify address bit counter 13- compare code rom
semiconductor group 5-1 reset / system clock c515 5 reset and system clock operation 5.1 hardware reset operation the hardware reset function incorporated in the c515 allows for an easy automatic start-up at a minimum of additional hardware and forces the controller to a predefined default state. the hardware reset function can also be used during normal operation in order to restart the device. this is particularly done when the power-down mode is to be terminated. additional to the hardware reset, which is applied externally to the c515, there exists another internal reset source, the watchdog timer. this chapter deals only with the external hardware reset. the reset input is an active low input. an internal schmitt trigger is used at the input for noise rejection. since the reset is synchronized internally, the reset pin must be held low for at least two machine cycles (24 oscillator periods) while the oscillator is running. with the oscillator running the internal reset is executed during the second machine cycle and is repeated every cycle until reset goes high again. during reset, pins ale and psen are configured as inputs and should not be stimulated or driven externally. (an external stimulation at these lines during reset activates several test modes which are reserved for test purposes. this in turn may cause unpredictable output operations at several port pins). at the reset pin, a pullup resistor is internally connected to v cc to allow a power-up reset with an external capacitor only. an automatic power-up reset can be obtained when v cc is applied by connecting the reset pin to v ss via a capacitor. after v cc has been turned on, the capacitor must hold the voltage level at the reset pin for a specific time to effect a complete reset.
semiconductor group 5-2 reset / system clock c515 the time required for a reset operation is the oscillator start-up time plus 2 machine cycles, which, under normal conditions, must be at least 10 - 20 ms for a crystal oscillator. this requirement is typically met using a capacitor of 4.7 to 10 m f. the same considerations apply if the reset signal is generated externally ( figure 5-1 b ). in each case it must be assured that the oscillator has started up properly and that at least two machine cycles have passed before the reset signal goes inactive. figure 5-1 reset circuitries a correct reset leaves the processor in a defined state. the program execution starts at location 0000 h . after reset is internally accomplished the port latches are set to ff h . this leaves port 0 floating, since it is an open drain port when not used as data/address bus. all other i/o port lines (ports 1 to 5) output a one (1). port 6 is an input-only port. it has no internal latch and therefore the contents of the special function registers p6 depend on the levels applied to port 6. the content of the internal ram of the c515 is not affected by a reset. after power-up the content is undefined, while it remains unchanged during a reset if the power supply is not turned off. mcs03203 reset c515 b) a) c) + + & reset reset c515 c515
semiconductor group 5-3 reset / system clock c515 5.2 hardware reset timing this section describes the timing of the hardware reset signal. the input pin reset is sampled once during each machine cycle. this happens in state 5 phase 2. thus, the external reset signal is synchronized to the internal cpu timing. when the reset is found active (low level) the internal reset procedure is started. it needs two complete machine cycles to put the complete device to its correct reset state, i.e. all special function registers contain their default values, the port latches contain 1's etc. note that this reset procedure is also performed if there is no clock available at the device. (this is done by the oscillator watchdog, which provides an auxiliary clock for performing a perfect reset without clock at the xtal1 and xtal2 pins). the reset signal must be active for at least one machine cycle; after this time the c515 remains in its reset state as long as the signal is active. when the signal goes inactive this transition is recognized in the following state 5 phase 2 of the machine cycle. then the processor starts its address output (when configured for external rom) in the following state 5 phase 1. one phase later (state 5 phase 2) the first falling edge at pin ale occurs. figure 5-2 shows this timing for a configuration with ea = 0 (external program memory). thus, between the release of the reset signal and the first falling edge at ale there is a time period of at least one machine cycle but less than two machine cycles. figure 5-2 cpu timing after reset mct01879 s4 s5 s6 s1 s2 s3 s4 s5 s6 s1 s2 s3 s4 s5 s6 s1 s2 p1 p2 pcl out pcl out pch out pch out one machine cycle reset p0 p2 ale in inst.
semiconductor group 5-4 reset / system clock c515 5.3 oscillator and clock circuit xtal1 and xtal2 are the output and input of a single-stage on-chip inverter which can be configured with off-chip components as a pierce oscillator. the oscillator, in any case, drives the internal clock generator. the clock generator provides the internal clock signals to the chip. these signals define the internal phases, states and machine cycles. figure 5-3 shows the recommended oscillator circuit. figure 5-3 recommended oscillator circuitry in this application the on-chip oscillator is used as a crystal-controlled, positive-reactance oscillator (a more detailed schematic is given in figure 5-4 ). lt is operated in its fundamental response mode as an inductive reactor in parallel resonance with a capacitor external to the chip. the crystal specifications and capacitances are non-critical. in this circuit 20 pf can be used as single capacitance at any frequency together with a good quality crystal. a ceramic resonator can be used in place of the crystal in cost-critical applications. if a ceramic resonator is used, the two capacitors normally have different values depending on the oscillator frequency. we recommend consulting the manufacturer of the ceramic resonator for value specifications of these capacitors. mcs03225 c c c = 20 pf 10 pf for crystal operation xtal2 xtal1 c515 - 24 mhz 1
semiconductor group 5-5 reset / system clock c515 figure 5-4 on-chip oscillator circuitry to drive the c515 with an external clock source, the external clock signal has to be applied to xtal2, as shown in figure 5-5 . xtal1 has to be left unconnected. a pullup resistor is suggested (to increase the noise margin), but is optional if v oh of the driving gate corresponds to the v ih2 specification of xtal2. figure 5-5 external clock source mcs03226 c515 xtal1 xtal2 to internal timing circuitry 1 cc 2 1) 1) crystal or ceramic resonator mcs03227 xtal1 xtal2 external clock v cc signal n.c. c515
semiconductor group 5-6 reset / system clock c515 5.4 system clock output for peripheral devices requiring a system clock, the c515 provides a clock output signal derived from the oscillator frequency as an alternate output function on pin p1.6/clkout. lf bit clk is set (bit 6 of special function register adcon), a clock signal with 1/12 of the oscillator frequency is gated to pin p1.6/clkout. to use this function the port pin must be programmed to a one (1), which is also the default after reset. special function register adcon (address d8 h ) reset value : 00x000000 b the system clock is high during s3p1 and s3p2 of every machine cycle and low during all other states. thus, the duty cycle of the clock signal is 1:6. associated with a movx instruction the system clock coincides with the last state (s3) in which a rd or wr signal is active. a timing diagram of the system clock output is shown in figure 5-6 . note : during slow-down operation the frequency of the clkout signal is divided by 8. bit function clk clockout enable bit when set, pin p1.6/clkout outputs the system clock which is 1/12 of the oscillator frequency. C reserved bit for future use. read by cpu returns undefined value. bd clk C bsy d8 h adcon bit no. df h de h dd h dc h db h da h d9 h d8 h msb lsb adm mx2 mx1 mx0 the shaded bits are not used for clock output control.
semiconductor group 5-7 reset / system clock c515 figure 5-6 timing diagram - system clock output mct01858 s6 s1 s2 s3 s4 s5 s6 s1 s2 s3 s4 s5 s6 s1 s2 ale psen rd,wr clkout
semiconductor group 6-1 on-chip peripheral components c515 6 on-chip peripheral components this chapter gives detailed information about all on-chip peripherals of the c515 except for the integrated interrupt controller, which is described separately in chapter 7 . 6.1 parallel i/o the c515 has six 8-bit i/o ports and one 8-bit input port for analog/digital input. port 0 is an open- drain bidirectional i/o port, while ports 1 to 5 are quasi-bidirectional i/o ports with internal pullup resistors. that means, when configured as inputs, ports 1 to 5 will be pulled high and will source current when externally pulled low. port 0 will float when configured as input. the output drivers of port 0 and 2 and the input buffers of port 0 are also used for accessing external memory. in this application, port 0 outputs the low byte of the external memory address, time multiplexed with the byte being written or read. port 2 outputs the high byte of the external memory address when the address is 16 bits wide. otherwise, the port 2 pins continue emitting the p2 sfr contents. in this function, port 0 is not an open-drain port, but uses a strong internal pullup fet . 6.1.1 port structures the c515 generally allows digital i/o on 48 lines grouped into 6 bidirectional c501 compatible 8-bit ports and one 8-bit analog/digital input port. each port bit (except port 6) consists of a latch, an output driver and an input buffer. read and write accesses to the i/o ports p0 to p5 are performed via their corresponding special function registers. depending on the specific ports, multiple functions are assigned to the port pins. these alternate functions of the port pins are listed in table 6-1 . when port 6 is used as analog input, an analog channel is switched to the a/d converter through a 3-bit multiplexer, which is controlled by three bits in sfr adcon (see chapter 6.4 ). port 6 lines may also be used as digital inputs. in this case they are addressed as an input port via sfr p6. since port 6 has no internal latch, the contents of sfr p6 only depends on the levels applied to the input lines. it makes no sense to output a value to these input-only port by writing to the sfr p6. this will have no effect.
semiconductor group 6-2 on-chip peripheral components c515 table 6-1 alternate functions of port 1 and 3 port alternate functions description p1.0 p1.1 p1.2 p1.3 p1.4 p1.5 p1.6 p1.7 p3.0 p3.1 p3.2 p3.3 p3.4 p3.5 p3.6 p3.7 int3 / cc0 int4 / cc1 int5 / cc2 int6 / cc3 int2 t2ex clkout t2 rxd txd int0 int1 t0 t1 wr rd external interrupt 3 input / capture/compare 0 input/output external interrupt 4 input / capture/compare 1 input/output external interrupt 5 input / capture/compare 2 input/output external interrupt 6 input / capture/compare 3 input/output external interrupt 2 input timer 2 external reload/trigger input system clock output timer 2 external count input serial ports receiver data input (asynchronous) or data input/output (synchronous) serial ports transmitter data output (asynchronous) or data clock output (synchronous) external interrupt 0 input, timer 0 gate control external interrupt 1 input, timer 1 gate control timer 0 external count input timer 1 external count input external data memory write strobe external data memory read strobe
semiconductor group 6-3 on-chip peripheral components c515 6.1.2 standard i/o port circuitry figure 6-1 shows a functional diagram of a typical bit latch and i/o buffer, which is the core of each of the six i/o-ports. the bit latch (one bit in the ports sfr) is represented as a type-d flip-flop, which will clock in a value from the internal bus in response to a "write-to-latch" signal from the cpu. the q output of the flip-flop is placed on the internal bus in response to a "read-latch" signal from the cpu. the level of the port pin itself is placed on the internal bus in response to a "read-pin" signal from the cpu. some instructions that read from a port (i.e. from the corresponding port sfr p0 to p4) activate the "read-latch" signal, while others activate the "read-pin" signal. figure 6-1 basic structure of a port circuitry mcs01822 d clk port latch q q port read latch to latch read pin write int. bus port driver circuit pin
semiconductor group 6-4 on-chip peripheral components c515 the output drivers of port 1 to 5 have internal pullup fets (see figure 6-2 ). each i/o line can be used independently as an input or output. to be used as an input, the port bit stored in the bit latch must contain a one (1) (that means for figure 6-2 : q =0), which turns off the output driver fet n1. then, for ports 1 to 5 the pin is pulled high by the internal pullups, but can be pulled low by an external source. when externally pulled low the port pins source current ( i il or i tl ). for this reason these ports are called "quasi-bidirectional". figure 6-2 basic output driver circuit of ports 1 to 5 mcs01823 d clk bit latch q q internal pull up arrangement pin read latch to latch read pin write v cc int. bus n1
semiconductor group 6-5 on-chip peripheral components c515 6.1.2.1 port 0 circuitry port 0, in contrast to ports 1 to 4, is considered as "true" bidirectional, because the port 0 pins float when configured as inputs. thus, this port differs in not having internal pullups. the pullup fet in the p0 output driver (see figure 6-3 ) is used only when the port is emitting 1s during the external memory accesses. otherwise, the pullup is always off. consequently, p0 lines that are used as output port lines are open drain lines. writing a "1" to the port latch leaves both output fets off and the pin floats. in that condition it can be used as high-impedance input. if port 0 is configured as general i/o port and has to emit logic high-level (1), external pullups are required. figure 6-3 port 0 circuitry mcs02434 d clk bit latch control addr./data mux pin read latch bus latch read pin write to v cc int. & port =1 q q
semiconductor group 6-6 on-chip peripheral components c515 6.1.2.2 port 1, port 3 to port 5 circuitry the pins of ports 1, 3, 4, and 5 are multifunctional. they are port pins and also serve to implement special features as listed in table 6-1 . figure 6-4 shows a functional diagram of a port latch with alternate function. to pass the alternate function to the output pin and vice versa, however, the gate between the latch and driver circuit must be open. thus, to use the alternate input or output functions, the corresponding bit latch in the port sfr has to contain a one (1); otherwise the pulldown fet is on and the port pin is stuck at 0. after reset all port latches contain ones (1). figure 6-4 ports 1, 3, 4 and 5 mcs01827 d clk bit latch q q internal pull up arrangement pin read latch to latch read pin write v cc int. bus alternate output function alternate input function &
semiconductor group 6-7 on-chip peripheral components c515 6.1.2.3 port 2 circuitry as shown in figure 6-3 and below in figure 6-5 , the output drivers of ports 0 and 2 can be switched to an internal address or address/data bus for use in external memory accesses. in this application they cannot be used as general purpose i/o, even if not all address lines are used externally. the switching is done by an internal control signal dependent on the input level at the ea pin and/or the contents of the program counter. if the ports are configured as an address/data bus, the port latches are disconnected from the driver circuit. during this time, the p0/p2 sfr remains unchanged. being an address/data bus, port 0 uses a pullup fet as shown in figure 6-3 . when a 16-bit address is used, port 2 uses the additional strong pullups p1 ( figure 6-6 ) to emit 1s for the entire external memory cycle instead of the weak ones (p2 and p3) used during normal port activity. figure 6-5 port 2 circuitry if no external bus cycles are generated using data or code memory accesses, port 0 can be used for i/o functions. mcs03228 d clk bit latch control addr. mux pin read latch latch read pin write to v cc int. bus port =1 q q internal pull up arrangement
semiconductor group 6-8 on-chip peripheral components c515 figure 6-6 port 2 pull-up arrangement port 2 in i/o function works similar to the standard port driver circuitry (section 6.1.2.4) whereas in address output function it works similar to port 0 circuitry. mcs03229 1 1 = 1 = 1 v cc port pin ss v input data (read pin) delay p1 p2 p3 n1 = 1 mux addr. control q 1 state _ < _ <
semiconductor group 6-9 on-chip peripheral components c515 6.1.2.4 detailed output driver circuitry in fact, the pullups mentioned before and included in figure 6-2, 6-4 and 6-5 are pullup arrangements. figure 6-7 shows the detailed output driver (pullup arrangement) circuit of the the port 1 and 3 to 5 port lines. the basic circuitry of these ports is shown in figure 6-4 . the pullup arrangement of these port lines has one n-channel pulldown fet and three pullup fets: figure 6-7 driver circuit of ports 1, 3 to 6 C the pulldown fet n1 is of n-channel type. it is a very strong driver transistor which is capable of sinking high currents ( i ol ); it is only activated if a "0" is programmed to the port pin. a short circuit to v cc must be avoided if the transistor is turned on, since the high current might destroy the fet. this also means that no 0 must be programmed into the latch of a pin that is used as input. C the pullup fet p1 is of p-channel type. it is activated for two oscillator periods (s1p1 and s1p2) if a 0-to-1 transition is programmed to the port pin, i.e. a "1" is programmed to the port latch which contained a "0". the extra pullup can drive a similar current as the pulldown fet n1. this provides a fast transition of the logic levels at the pin. C the pullup fet p2 is of p-channel type. it is always activated when a "1" is in the port latch, thus providing the logic high output level. this pullup fet sources a much lower current than p1; therefore the pin may also be tied to ground, e.g. when used as input with logic low input level. mcs03230 =1 1 =1 =1 v cc port pin ss v q input data (read pin) p1 p2 p3 n1 delay = 1 state _ <
semiconductor group 6-10 on-chip peripheral components c515 C the pullup fet p3 is of p-channel type. it is only activated if the voltage at the port pin is higher than approximately 1.0 to 1.5 v. this provides an additional pullup current if a logic high level shall be output at the pin (and the voltage is not forced lower than approximately 1.0 to 1.5 v). however, this transistor is turned off if the pin is driven to a logic low level, e.g when used as input. in this configuration only the weak pullup fet p2 is active, which sources the current i il . if, in addition, the pullup fet p3 is activated, a higher current can be sourced ( i tl ). thus, an additional power consumption can be avoided if port pins are used as inputs with a low level applied. however, the driving capability is stronger if a logic high level is output. the described activating and deactivating of the four different transistors translates into four states the pins can be: C input low state (il), p2 active only C input high state (ih) = steady output high state (soh) p2 and p3 active C forced output high state (foh), p1, p2 and p3 active C output low state (ol), n1 active if a pin is used as input and a low level is applied, it will be in il state, if a high level is applied, it will switch to ih state. if the latch is loaded with "0", the pin will be in ol state. if the latch holds a "0" and is loaded with "1", the pin will enter foh state for two cycles and then switch to soh state. if the latch holds a "1" and is reloaded with a "1" no state change will occur. at the beginning of power-on reset the pins will be in il state (latch is set to "1", voltage level on pin is below of the trip point of p3). depending on the voltage level and load applied to the pin, it will remain in this state or will switch to ih (=soh) state. if it is used as output, the weak pull-up p2 will pull the voltage level at the pin above p3s trip point after some time and p3 will turn on and provide a strong "1". note, however, that if the load exceeds the drive capability of p2 ( i il ), the pin might remain in the il state and provide a week "1" until the first 0-to-1 transition on the latch occurs. until this the output level might stay below the trip point of the external circuitry. the same is true if a pin is used as bidirectional line and the external circuitry is switched from output to input when the pin is held at "0" and the load then exceeds the p2 drive capabilities. if the load exceeds i il the pin can be forced to "1" by writing a "0" followed by a "1" to the port pin.
semiconductor group 6-11 on-chip peripheral components c515 6.1.3 port timing when executing an instruction that changes the value of a port latch, the new value arrives at the latch during s6p2 of the final cycle of the instruction. however, port latches are only sampled by their output buffers during phase 1 of any clock period (during phase 2 the output buffer holds the value it noticed during the previous phase 1). consequently, the new value in the port latch will not appear at the output pin until the next phase 1, which will be at s1p1 of the next machine cycle. when an instruction reads a value from a port pin (e.g. mov a, p1) the port pin is actually sampled in state 5 phase 1 or phase 2 depending on port and alternate functions. figure 6-8 illustrates this port timing. it must be noted that this mechanism of sampling once per machine cycle is also used if a port pin is to detect an "edge", e.g. when used as counter input. in this case an "edge" is detected when the sampled value differs from the value that was sampled the cycle before. therefore, there must be met certain reqirements on the pulse length of signals in order to avoid signal "edges" not being detected. the minimum time period of high and low level is one machine cycle, which guarantees that this logic level is noticed by the port at least once. figure 6-8 port timing mct03231 p1 p2 s4 s5 p2 p1 s6 p2 p1 s1 p2 p1 s2 p2 p1 s3 p2 p1 xtal2 input sampled: e.g. mov a, p1 old data new data port p1 active for 1 state (driver transistor)
semiconductor group 6-12 on-chip peripheral components c515 6.1.4 port loading and interfacing the output buffers of ports 1 to 5 can drive ttl inputs directly. the maximum port load which still guarantees correct logic output levels can be be looked up in the dc characteristics in the data sheet of the c515 or in chapter 10 of this users manual. the corresponding parameters are v ol and v oh . the same applies to port 0 output buffers. they do, however, require external pullups to drive floating inputs, except when being used as the address/data bus. when used as inputs it must be noted that the ports 1 to 5 are not floating but have internal pullup transistors. the driving devices must be capable of sinking a sufficient current if a logic low level shall be applied to the port pin (the parameters i tl and i il in the dc characteristics specify these currents). port 0 as well as port 1 programmed to analog input function, however, have floating inputs when used for digital input.
semiconductor group 6-13 on-chip peripheral components c515 6.1.5 read-modify-write feature of ports 0 to 5 some port-reading instructions read the latch and others read the pin. the instructions reading the latch rather than the pin read a value, possibly change it, and then rewrite it to the latch. these are called "read-modify-write"- instructions, which are listed in table 6-2 . if the destination is a port or a port pin, these instructions read the latch rather than the pin. note that all other instructions which can be used to read a port, exclusively read the port pin. in any case, reading from latch or pin, resp., is performed by reading the sfr p0, p2 and p3; for example, "mov a, p3" reads the value from port 3 pins, while "anl p3, #0aah" reads from the latch, modifies the value and writes it back to the latch. it is not obvious that the last three instructions in table 6-2 are read-modify-write instructions, but they are. the reason is that they read the port byte, all 8 bits, modify the addressed bit, then write the complete byte back to the latch. the reason why read-modify-write instructions are directed to the latch rather than the pin is to avoid a possible misinterpretation of the voltage level at the pin. for example, a port bit might be used to drive the base of a transistor. when a "1" is written to the bit, the transistor is turned on. if the cpu then reads the same port bit at the pin rather than the latch, it will read the base voltage of the transitor (approx. 0.7 v, i.e. a logic low level!) and interpret it as "0". for example, when modifying a port bit by a setb or clr instruction, another bit in this port with the above mentioned configuration might be changed if the value read from the pin were written back to th latch. however, reading the latch rater than the pin will return the correct value of "1". table 6-2 "read-modify-write"-instructions instruction function anl logic and; e.g. anl p1, a orl logic or; e.g. orl p2, a xrl logic exclusive or; e.g. xrl p3, a jbc jump if bit is set and clear bit; e.g. jbc p1.1, label cpl complement bit; e.g. cpl p3.0 inc increment byte; e.g. inc p4 dec decrement byte; e.g. dec p5 djnz decrement and jump if not zero; e.g. djnz p3, label mov px.y,c move carry bit to bit y of port x clr px.y clear bit y of port x setb px.y set bit y of port x
semiconductor group 6-14 on-chip peripheral components c515 6.2 timers/counters the c515 contains three general purpose 16-bit timers/counters, timer 0, 1, and 2, which are useful in many applications for timing and counting. in "timer" function, the timer register is incremented every machine cycle. thus one can think of it as counting machine cycles. since a machine cycle consists of 12 oscillator periods, the counter rate is 1/12 of the oscillator frequency. in "counter" function, the register is incremented in response to a 1-to-0 transition (falling edge) at its corresponding external input pin, t0 or t1 (alternate functions of p3.4 and p3.5, resp.). in this function the external input is sampled during s5p2 of every machine cycle. when the samples show a high in one cycle and a low in the next cycle, the count is incremented. the new count value appears in the register during s3p1 of the cycle following the one in which the transition was detected. since it takes two machine cycles (24 oscillator periods) to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. there are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once before it changes, it must be held for at least one full machine cycle. 6.2.1 timer/counter 0 and 1 timer / counter 0 and 1 of the c515 are fully compatible with timer / counter 0 and 1 of the c501 and can be used in the same four operating modes: mode 0: 8-bit timer/counter with a divide-by-32 prescaler mode 1: 16-bit timer/counter mode 2: 8-bit timer/counter with 8-bit auto-reload mode 3: timer/counter 0 is configured as one 8-bit timer/counter and one 8-bit timer; timer/ counter 1 in this mode holds its count. the effect is the same as setting tr1 = 0. external inputs int0 and int1 can be programmed to function as a gate for timer/counters 0 and 1 to facilitate pulse width measurements. each timer consists of two 8-bit registers (th0 and tl0 for timer/counter 0, th1 and tl1 for timer/ counter 1) which may be combined to one timer configuration depending on the mode that is established. the functions of the timers are controlled by two special function registers tcon and tmod. in the following descriptions the symbols th0 and tl0 are used to specify the high-byte and the low-byte of timer 0 (th1 and tl1 for timer 1, respectively). the operating modes are described and shown for timer 0. if not explicity noted, this applies also to timer 1.
semiconductor group 6-15 on-chip peripheral components c515 6.2.1.1 timer/counter 0 and 1 registers totally six special function registers control the timer/counter 0 and 1 operation : C tl0/th0 and tl1/th1 - counter registers, low and high part C tcon and tmod - control and mode select registers special function register tl0 (address 8a h ) reset value : 00 h special function register th0 (address 8c h ) reset value : 00 h special function register tl1 (address 8b h ) reset value : 00 h special function register th1 (address 8d h ) reset value : 00 h bit function tlx.7-0 x=0-1 timer/counter 0/1 low register thx.7-0 x=0-1 timer/counter 0/1 high register .7 .6 .5 .4 8a h tl0 bit no. 76543210 msb lsb .3 .2 .1 .0 .7 .6 .5 .4 8c h th0 .3 .2 .1 .0 .7 .6 .5 .4 8b h tl1 .3 .2 .1 .0 .7 .6 .5 .4 8d h th1 .3 .2 .1 .0 operating mode description 0 "tlx" holds the 5-bit prescaler value. 1 "tlx" holds the lower 8-bit part of the 16-bit timer/counter value. 2 "tlx" holds the 8-bit timer/counter value. 3 tl0 holds the 8-bit timer/counter value; tl1 is not used. operating mode description 0 "thx" holds the 8-bit timer/counter value. 1 "thx" holds the higher 8-bit part of the 16-bit timer/counter valu e 2 "thx" holds the 8-bit reload value. 3 th0 holds the 8-bit timer value; th1 is not used.
semiconductor group 6-16 on-chip peripheral components c515 special function register tcon (address 88 h ) reset value : 00 h bit function tr0 timer 0 run control bit set/cleared by software to turn timer/counter 0 on/off. tf0 timer 0 overflow flag set by hardware on timer/counter overflow. cleared by hardware when processor vectors to interrupt routine. tr1 timer 1 run control bit set/cleared by software to turn timer/counter 1 on/off. tf1 timer 1 overflow flag set by hardware on timer/counter overflow. cleared by hardware when processor vectors to interrupt routine. 8f h 8e h 8d h 8c h 8b h 8a h 89 h 88 h tf1 tr1 tf0 tr0 88 h tcon bit no. 76543210 msb lsb ie1 it1 ie0 it0 the shaded bits are not used in controlling timer/counter 0 and 1.
semiconductor group 6-17 on-chip peripheral components c515 special function register tmod (address 89 h ) reset value : 00 h bit function gate gating control when set, timer/counter "x" is enabled only while "int x" pin is high and "trx" control bit is set. when cleared timer "x" is enabled whenever "trx" control bit is set. c/t counter or timer select bit set for counter operation (input from "tx" input pin). cleared for timer operation (input from internal system clock). m1 m0 mode select bits gate c/t m1 m0 89 h tmod bit no. 76543210 msb lsb gate c/t m1 m0 timer 1 control timer 0 control m1 m0 function 0 0 8-bit timer/counter: "thx" operates as 8-bit timer/counter "tlx" serves as 5-bit prescaler 0 1 16-bit timer/counter. "thx" and "tlx" are cascaded; there is no prescaler 1 0 8-bit auto-reload timer/counter. "thx" holds a value which is to be reloaded into "tlx" each time it overflows 1 1 timer 0 : tl0 is an 8-bit timer/counter controlled by the standard timer 0 control bits. th0 is an 8-bit timer only controlled by timer 1 control bits. timer 1 : timer/counter 1 stops
semiconductor group 6-18 on-chip peripheral components c515 6.2.1.2 mode 0 putting either timer/counter 0,1 into mode 0 configures it as an 8-bit timer/counter with a divide-by- 32 prescaler. figure 6-9 shows the mode 0 operation. in this mode, the timer register is configured as a 13-bit register. as the count rolls over from all 1s to all 0s, it sets the timer overflow flag tf0. the overflow flag tf0 then can be used to request an interrupt. the counted input is enabled to the timer when tr0 = 1 and either gate = 0 or int0 = 1 (setting gate = 1 allows the timer to be controlled by external input int0 , to facilitate pulse width measurements). tr0 is a control bit in the special function register tcon; gate is in tmod. the 13-bit register consists of all 8 bits of th0 and the lower 5 bits of tl0. the upper 3 bits of tl0 are indeterminate and should be ignored. setting the run flag (tr0) does not clear the registers. mode 0 operation is the same for timer 0 as for timer 1. substitute tr0, tf0, th0, tl0 and int0 for the corresponding timer 1 signals in figure 6-9 . there are two different gate bits, one for timer 1 (tmod.7) and one for timer 0 (tmod.3). figure 6-9 timer/counter 0, mode 0: 13-bit timer/counter mcs02583 1 & osc c/t = 0 tl0 th0 tf0 c/t = 1 tr0 gate p3.2/into control interrupt p3.4/t0 (5 12 =1 bits) bits) (8 _ <
semiconductor group 6-19 on-chip peripheral components c515 6.2.1.3 mode 1 mode 1 is the same as mode 0, except that the timer register is running with all 16 bits. mode 1 is shown in figure 6-10 . figure 6-10 timer/counter 0, mode 1: 16-bit timer/counter p3.2/int0 mcs02095 1 & osc c/t = 0 tl0 th0 tf0 c/t = 1 (8 bits) tr0 gate p3.2/into control interrupt p3.4/t0 (8 bits) _ < 12 =1
semiconductor group 6-20 on-chip peripheral components c515 6.2.1.4 mode 2 mode 2 configures the timer register as an 8-bit counter (tl0) with automatic reload, as shown in figure 6-11 . overflow from tl0 not only sets tf0, but also reloads tl0 with the contents of th0, which is preset by software. the reload leaves th0 unchanged. figure 6-11 timer/counter 0,1, mode 2: 8-bit timer/counter with auto-reload p3.2/int0
semiconductor group 6-21 on-chip peripheral components c515 6.2.1.5 mode 3 mode 3 has different effects on timer 0 and timer 1. timer 1 in mode 3 simply holds its count. the effect is the same as setting tr1=0. timer 0 in mode 3 establishes tl0 and th0 as two seperate counters. the logic for mode 3 on timer 0 is shown in figure 6-12 . tl0 uses the timer 0 control bits: c/t , gate, tr0, int0 and tf0. th0 is locked into a timer function (counting machine cycles) and takes over the use of tr1 and tf1 from timer 1. thus, th0 now controls the "timer 1" interrupt. mode 3 is provided for applications requiring an extra 8-bit timer or counter. when timer 0 is in mode 3, timer 1 can be turned on and off by switching it out of and into its own mode 3, or can still be used by the serial channel as a baud rate generator, or in fact, in any application not requiring an interrupt from timer 1 itself. figure 6-12 timer/counter 0, mode 3: two 8-bit timers/counters mcs02096 1 & osc c/t = 0 tl0 tf0 c/t = 1 (8 bits) tr1 gate p3.2/int0 control interrupt (8 bits) th0 interrupt tf1 control tr1 /12 f osc osc f /12 p3.4/t0 12 =1 < _
semiconductor group 6-22 on-chip peripheral components c515 6.2.2 timer/counter 2 with additional compare/capture/reload the timer 2 with additional compare/capture/reload features is one of the most powerful peripheral units of the c515. lt can be used for all kinds of digital signal generation and event capturing like pulse generation, pulse width modulation, pulse width measuring etc. timer 2 is designed to support various automotive control applications (ignition/injection-control, anti-lock-brake ... ) as well as industrial applications (dc-, three-phase ac- and stepper-motor control, frequency generation, digital-to-analog conversion, process control ...). please note that this timer is not equivalent to timer 2 of the c501. the c515 timer 2 in combination with the compare/capture/reload registers allows the following operating modes: C compare : up to 4 pwm signals with 65535 steps at maximum and 500 ns resolution C capture : up to 4 high speed capture inputs with 500 ns resolution C reload : modulation of timer 2 cycle time the block diagram in figure 6-13 shows the general configuration of timer 2 with the additional compare/capture/reload registers. the i/o pins which can used for timer 2 control are located as multifunctional port functions at port 1 (see table 6-3 ). table 6-3 alternate port functions of timer 2 pin symbol function p1.0 / int3 / cc0 compare output / capture input for crc register p1.1 / int4 / cc1 compare output / capture input for cc register 1 p1.2 / int5 / cc2 compare output / capture input for cc register 2 p1.3 / int6 / cc3 compare output / capture input for cc register 3 p1.5 / t2ex external reload trigger input p1.7 / t2 external count or gate input to timer 2
semiconductor group 6-23 on-chip peripheral components c515 figure 6-13 timer 2 block diagram mcb03205 comparator ccl3/cch3 capture input/ output control p1.0/ int3/ cc0 cc1 int4/ p1.1/ cc2 int5/ p1.2/ cc3 int6/ p1.2/ ccl2/cch2 comparator ccl1/cch1 comparator crcl/crch comparator bit 16 16 bit 16 bit 16 bit osc 12 24 f osc t2ps sync. p1.7/ t2 t2ex p1.5/ sync. & t2i1 t2i0 timer 2 th2 tl2 tf2 reload exen2 reload 1 exf2 interrupt request compare _ <
semiconductor group 6-24 on-chip peripheral components c515 6.2.2.1 timer 2 registers this chapter describes all timer 2 related special function registers of timer 2. the interrupt related sfrs are also included in this section. table 6-4 summarizes all timer 2 sfrs. table 6-4 special function registers of the timer 2 unit symbol description address t2con tl2 th2 ccen crcl crch ccl1 cch1 ccl2 cch2 ccl3 cch3 ien0 ien1 ircon timer 2 control register timer 2, low byte timer 2, high byte compare / capture enable register compare / reload / capture register, low byte compare / reload / capture register, high byte compare / capture register 1, low byte compare / capture register 1, high byte compare / capture register 2, low byte compare / capture register 2, high byte compare / capture register 3, low byte compare / capture register 3, high byte interrupt enable register 0 interrupt enable register 1 interrupt control register c8 h cc h cd h c1 h ca h cb h c2 h c3 h c4 h c5 h c6 h c7 h a8 h b8 h c0 h
semiconductor group 6-25 on-chip peripheral components c515 the t2con timer 2 control register is a bitaddressable register which controls the timer 2 function and the compare mode of registers crc, cc1 to cc3. special function register t2con (address c8 h ) reset value : 00 h bit function t2ps prescaler select bit when set, timer 2 is clocked in the timer or gated timer function with 1/24 of the oscillator frequency. when cleared, timer 2 is clocked with 1/12 of the oscillator frequency. t2ps must be 0 for the counter operation of timer 2. i3fr external interrupt 3 falling/rising edge flag used for capture function in combination with register crc. lf set, a capture to register crc (if enabled) will occur on a positive transition at pin p1.0 / int3 / cc0. lf i3fr is cleared, a capture will occur on a negative transition. t2r1 t2r0 timer 2 reload mode selection t2cm compare mode bit for registers crc, cc1 through cc3 when set, compare mode 1 is selected. t2cm = 0 selects compare mode 0. t2i1 t2i0 timer 2 input selection cf h ce h cd h cc h cb h ca h c9 h c8 h t2ps i3fr i2fr t2r1 c8 h t2con the shaded bit is not used in controlling timer/counter 2. bit no. 76543210 msb lsb t2r0 t2cm t2i1 t2i0 t2r1 t2r0 function 0 x reload disabled 1 0 mode 0 : auto-reload upon timer 2 overflow (tf2) 1 1 mode 1 : reload on falling edge at pin p1.5 / t2ex. t2i1 t2i0 function 0 0 no input selected, timer 2 stops 0 1 timer function : input frequency = f osc /12 (t2ps = 0) or f osc /24 (t2ps = 1) 1 0 counter function : external input signal at pin p1.7 / t2 1 1 gated timer function : input controlled by pin p1.7 / t2
semiconductor group 6-26 on-chip peripheral components c515 special function register tl2 (address cc h ) reset value : 00 h special function register th2 (address cd h ) reset value : 00 h special function register crcl (address ca h ) reset value : 00 h special function register crch (address cb h ) reset value : 00 h bit function tl2.7-0 timer 2 value low byte the tl2 register holds the 8-bit low part of the 16-bit timer 2 count value. th2.7-0 timer 2 value high byte the th2 register holds the 8-bit high part of the 16-bit timer 2 count value. crcl.7-0 compare / reload / capture register low byte crcl is the 8-bit low byte of the 16-bit reload register of timer 2. it is also used for compare/capture functions. crch.7-0 compare / reload / capture register high byte crch is the 8-bit high byte of the 16-bit reload register of timer 2. it is also used for compare/capture functions. .7 .6 .5 .4 cc h tl2 bit no. 76543210 msb lsb .3 .2 .1 lsb msb .6 .5 .4 cd h th2 .3 .2 .1 .0 .7 .6 .5 .4 ca h crcl .3 .2 .1 lsb msb .6 .5 .4 cb h crch .3 .2 .1 .0
semiconductor group 6-27 on-chip peripheral components c515 special function register ien0 (address a8 h ) reset value : 00 h special function register ien1 (address b8 h ) reset value : 00 h special function register ircon (address c0 h ) reset value : 00 h bit function et2 timer 2 overflow / external reload interrupt enable. if et2 = 0, the timer 2 interrupt is disabled. if et2 = 1, the timer 2 interrupt is enabled. exen2 timer 2 external reload interrupt enable if exen2 = 0, the timer 2 external reload interrupt is disabled. if exen2 = 1, the timer 2 external reload interrupt is enabled. the external reload function is not affected by exen2. exf2 timer 2 external reload flag exf2 is set when a reload is caused by a falling edge on pin t2ex while exen2 = 1. if et2 in ien0 is set (timer 2 interrupt enabled), exf2 = 1 will cause an interrupt. exf2 can be used as an additional external interrupt when the reload function is not used. exf2 must be cleared by software. tf2 timer 2 overflow flag set by a timer 2 overflow and must be cleared by software. if the timer 2 interrupt is enabled, tf2 = 1 will cause an interrupt. exf2 tf2 iex6 iex5 c0 h ircon bit no. c7 h iex4 iex3 iex2 iadc c6 h c5 h c4 h c3 h c2 h c1 h c0 h the shaded bits are not used in timer/counter 2 interrupt control. eal wdt et2 es a8 h ien0 bit no. af h msb lsb et1 ex1 et0 ex0 ae h ad h ac h ab h aa h a9 h a8 h exen2 swdt ex6 ex5 b8 h ien1 bit no. bf h ex4 ex3 ex2 eadc be h bd h bc h bb h ba h b9 h b8 h
semiconductor group 6-28 on-chip peripheral components c515 special function register ccen (address c1 h ) reset value : 00 h bit function cocah3 cocal3 compare/capture mode for cc register 3 cocah2 cocal2 compare/capture mode for cc register 2 cocah1 cocal1 compare/capture mode for cc register 1 cocah0 cocal0 compare/capture mode for crc register cocah3 cocal3 cocah2 cocal2 c1 h ccen bit no. 76543210 msb lsb cocah1 cocal1 cocah0 cocal0 cocah3 cocal3 function 0 0 compare/capture disabled 0 1 capture on rising edge at pin p1.3 / int6 / cc3 1 0 compare enabled 1 1 capture on write operation into register ccl3 cocah2 cocal2 function 0 0 compare/capture disabled 0 1 capture on rising edge at pin p1.2 / int5 / cc2 1 0 compare enabled 1 1 capture on write operation into register ccl2 cocah1 cocal1 function 0 0 compare/capture disabled 0 1 capture on rising edge at pin p1.1 / int4 / cc1 1 0 compare enabled 1 1 capture on write operation into register ccl1 cocah0 cocal0 function 0 0 compare/capture disabled 0 1 capture on falling/rising edge at pin p1.0 / int3 / cc0 1 0 compare enabled 1 1 capture on write operation into register crcl
semiconductor group 6-29 on-chip peripheral components c515 6.2.2.2 timer 2 operation the timer 2, which is a 16-bit-wide register, can operate as timer, event counter, or gated timer. the detailed operation is described below. timer mode in timer function, the count rate is derived from the oscillator frequency. a prescaler offers the possibility of selecting a count rate of 1/12 or 1/24 of the oscillator frequency. thus, the 16-bit timer register (consisting of th2 and tl2) is either incremented in every machine cycle or in every second machine cycle. the prescaler is selected by bit t2ps in special function register t2con. lf t2ps is cleared, the input frequency is 1/12 of the oscillator frequency. if t2ps is set, the 2:1 prescaler gates 1/24 of the oscillator frequency to the timer. gated timer mode in gated timer function, the external input pin p1.7 / t2 functions as a gate to the input of timer 2. lf t2 is high, the internal clock input is gated to the timer. t2 = 0 stops the counting procedure. this facilitates pulse width measurements. the external gate signal is sampled once every machine cycle. event counter mode in the counter function, the timer 2 is incremented in response to a 1-to-0 transition at its corresponding external input pin p1.7 / t2 in this function, the external input is sampled every machine cycle. when the sampled inputs show a high in one cycle and a low in the next cycle, the count is incremented. the new count value appears in the timer register in the cycle following the one in which the transition was detected. since it takes two machine cycles (24 oscillator periods) to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. there are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once before it changes, it must be held for at least one full machine cycle. note: the prescaler must be off for proper counter operation of timer 2, i.e. t2ps must be 0. in either case, no matter whether timer 2 is configured as timer, event counter, or gated timer, a rolling-over of the count from all 1s to all 0s sets the timer overflow flag tf2 in sfr ircon, which can generate an interrupt. lf tf2 is used to generate a timer overflow interrupt, the request flag must be cleared by the interrupt service routine as it could be necessary to check whether it was the tf2 flag or the external reload request flag exf2 which requested the interrupt. both request flags cause the program to branch to the same vector address.
semiconductor group 6-30 on-chip peripheral components c515 reload of timer 2 the reload mode for timer 2 is selected by bits t2r0 and t2r1 in sfr t2con. figure 6-14 shows the configuration of timer 2 in reload mode. mode 0 : when timer 2 rolls over from all ls to all 0s, it not only sets tf2 but also causes the timer 2 registers to be loaded with the 16-bit value in the crc register, which is preset by software. the reload will happen in the same machine cycle in which tf2 is set, thus overwriting the count value 0000 h . mode 1 : when a 16-bit reload from the crc register is caused by a negative transition at the corresponding input pin t2ex/p1.5. in addition, this transition will set flag exf2, if bit exen2 in sfr ien1 is set. lf the timer 2 interrupt is enabled, setting exf2 will generate an interrupt. the external input pin t2ex is sampled in every machine cycle. when the sampling shows a high in one cycle and a low in the next cycle, a transition will be recognized. the reload of timer 2 registers will then take place in the cycle following the one in which the transition was detected. figure 6-14 timer 2 in reload mode mcs01903 1 mode 1 exf2 0 mode exen2 tf2 crch crcl reload th2 tl2 input clock timer interrupt request t2ex p1.5 2 < _
semiconductor group 6-31 on-chip peripheral components c515 6.2.2.3 compare function of registers crc, cc1 to cc3 the compare function of a timer/register combination can be described as follows. the 16-bit value stored in a compare/capture register is compared with the contents of the timer register. lf the count value in the timer register matches the stored value, an appropriate output signal is generated at a corresponding port pin, and an interrupt is requested. the contents of a compare register can be regarded as time stamp at which a dedicated output reacts in a predefined way (either with a positive or negative transition). variation of this time stamp somehow changes the wave of a rectangular output signal at a port pin. this may - as a variation of the duty cycle of a periodic signal - be used for pulse width modulation as well as for a continually controlled generation of any kind of square wave forms. two compare modes are implemented to cover a wide range of possible applications. the compare modes 0 and 1 are selected by bit t2cm in special function register t2con. in both compare modes, the new value arrives at the port pin 1 within the same machine cycle in which the internal compare signal is activated. the four registers crc, cc1 to cc3 are multifunctional as they additionally provide a capture, compare or reload capability (the crc register only). a general selection of the function is done in register ccen. please note that the compare interrupt cc0 can be programmed to be negative or positive transition activated. the internal compare signal (not the output signal at the port pin!) is active as long as the timer 2 contents is equal to the one of the appropriate compare registers, and it has a rising and a falling edge. thus, when using the crc register, it can be selected whether an interrupt should be caused when the compare signal goes active or inactive, depending on bit i3fr in t2con. for the cc registers 1 to 3 an interrupt is always requested when the compare signal goes active (see figure 6-16 ). 6.2.2.3.1 compare mode 0 in mode 0, upon matching the timer and compare register contents, the output signal changes from low to high. lt goes back to a low level on timer overflow. as long as compare mode 0 is enabled, the appropriate output pin is controlled by the timer circuit only, and not by the user. writing to the port will have no effect. figure 6-15 shows a functional diagram of a port latch in compare mode 0. the port latch is directly controlled by the two signals timer overflow and compare. the input line from the internal bus and the write-to-latch line are disconnected when compare mode 0 is enabled. compare mode 0 is ideal for generating pulse width modulated output signals, which in turn can be used for digital-to-analog conversion via a filter network or by the controlled device itself (e.g. the inductance of a dc or ac motor). mode 0 may also be used for providing output clocks with initially defined period and duty cycle. this is the mode which needs the least cpu time. once set up, the output goes on oscillating without any cpu intervention. figure 6-16 and 6-17 illustrate the function of compare mode 0.
semiconductor group 6-32 on-chip peripheral components c515 figure 6-15 port latch in compare mode 0 figure 6-16 timer 2 with registers ccx in compare mode 0 mcs02661 latch port q q clk d port pin read pin cc v read latch port circuit internal bus latch write to compare reg. compare register circuit comparator timer register timer circuit compare match s r overflow timer 16 bit bit 16 mcs03233 iexx for crc only cc0 int3/ p1.0/ compare signal overflow interrupt set latch reset latch tl2 timer 2 th2 comparator shaded function interrupt 16-bit compare register ccx p1.3/ int6/ cc3 q r ss r q s r q s r q cc2 int5/ p1.2/ p1.1/ int4/ cc1 16-bit i3fr
semiconductor group 6-33 on-chip peripheral components c515 figure 6-17 function of compare mode 0 6.2.2.3.2 modulation range in compare mode 0 generally it can be said that for every pwm generation in compare mode 0 with n-bit wide compare registers there are 2 n different settings for the duty cycle. starting with a constant low level (0%duty cycle) as the first setting, the maximum possible duty cycle then would be : (1 - 1/2 n ) x 100% this means that a variation of the duty cycle from 0% to real 100% can never be reached if the compare register and timer register have the same length. there is always a spike which is as long as the timer clock period. this spike may either appear when the compare register is set to the reload value (limiting the lower end of the modulation range) or it may occur at the end of a timer period. in a timer 2/ccx register configuration in compare mode 0 this spike is divided into two halves: one at the beginning when the contents of the compare register is equal to the reload value of the timer; the other half when the compare register is equal to the maximum value of the timer register (here: ffff h ). please refer to figure 6-18 where the maximum and minimum duty cycle of a compare output signal is illustrated. timer 2 is incremented with the machine clock (fosc/12), thus at 24 -mhz operational frequency, these spikes are both approx. 250 ns long. mct01906 timer count = ffff timer count = compare value contents of timer 2 timer count = reload value interrupt can be generated on overflow compare output (p1.x/ccx) interrupt can be generated on compare-match ~ ~ ~ ~ h
semiconductor group 6-34 on-chip peripheral components c515 figure 6-18 modulation range of a pwm signal, generated with a timer 2/ccx register combination in compare mode 0* the following example shows how to calculate the modulation range for a pwm signal. to calculate with reasonable numbers, a reduction of the resolution to 8-bit is used. otherwise (for the maximum resolution of 16-bit) the modulation range would be so severely limited that it would be negligible. example: timer 2 in auto-reload mode; contents of reload register crc = ff00 h restriction of modulation range = 1 / 256 x 2 x 100% = 0.195% this leads to a variation of the duty cycle from 0.195% to 99.805% for a timer 2/ccx register configuration when 8 of 16 bits are used. mct01907 h l p1.x cchx/cclx = 0000 or = crch/crcl (maximum duty cycle) p1.x l h cchx/cclx = ffff (minimum duty cycle) appr. 1/2 machine cycle a) b) appr. 1/2 machine cycle h h
semiconductor group 6-35 on-chip peripheral components c515 6.2.2.3.3 compare mode 1 in compare mode 1, the software adaptively determines the transition of the output signal. lt is commonly used when output signals are not related to a constant signal perlod (as in a standard pwm generation) but must be controlled very precisely with high resolution and without jitter. in compare mode 1, both transitions of a signal can be controlled. compare outputs in this mode can be regarded as high speed outputs which are independent of the cpu activity. lf compare mode 1 is enabled and the software writes to the appropriate output latch at the port, the new value will not appear at the output pin until the next compare match occurs. thus, one can choose whether the output signal is to make a new transition (1-to-0 or 0-to-1, depending on the actual pinlevel) or should keep its old value at the time the timer 2 count matches the stored compare value. figure 6-19 and figure 6-20 show functional diagrams of the timer/compare register/port latch configuration in compare mode 1. in this function, the port latch consists of two separate latches. the upper latch (which acts as a shadow latch) can be written under software control, but its value will only be transferred to the output latch (and thus to the port pin) in response to a compare match. note that the double latch structure is transparent as long as the internal compare signal is active. while the compare signal is active, a write operation to the port will then change both latches. this may become important when driving timer 2 with a slow external clock. in this case the compare signal could be active for many machine cycles in which the cpu could unintentionally change the contents of the port latch. a read-modify-write instruction will read the user-controlled ?shadow latch and write the modified value back to this shadow-latch. a standard read instruction will - as usual - read the pin of the corresponding compare output.
semiconductor group 6-36 on-chip peripheral components c515 figure 6-19 port latch in compare mode 1 figure 6-20 timer 2 with registers ccx in compare mode 1 (ccx stands for crc, cc1 to cc3, iexx stands for iex3 to iex6) mcs02662 latch port q q clk d read pin cc v d clk q shadow latch read latch port circuit internal bus latch write to compare reg. compare register circuit comparator timer register timer circuit compare match pin port 16 bit 16 bit mcs02732 iexx for crc only p1.7 cc0 int3/ p1.0/ compare signal overflow interrupt output latch shadow latch port latch circuit 2 tl2 timer th2 comparator shaded function interrupt 16 bit 16 bit compare register ccx p1.3/ int6/ cc3 i3fr
semiconductor group 6-37 on-chip peripheral components c515 6.2.2.4 using interrupts in combination with the compare function the compare service of registers crc, cc1, cc2 and cc3 is assigned to alternate output functions at port pins p1.0 to p1.3. another option of these pins is that they can be used as external interrupt inputs. however, when using the port lines as compare outputs then the input line from the port pin to the interrupt system is disconnected (but the pins level can still be read under software control). thus, a change of the pins level will not cause a setting of the corresponding interrupt flag. in this case, the interrupt input is directly connected to the (internal) compare signal thus providing a compare interrupt. the compare interrupt can be used very effectively to change the contents of the compare registers or to determine the level of the port outputs for the next compare match. the principle is, that the internal compare signal (generated at a match between timer count and register contents) not only manipulates the compare output but also sets the corresponding interrupt request flag. thus, the current task of the cpu is interrupted - of course provided the priority of the compare interrupt is higher than the present task priority - and the corresponding interrupt service routine is called. this service routine then sets up all the necessary parameters for the next compare event. advantages when using compare interrupts firstly, there is no danger of unintentional overwriting a compare register before a match has been reached. this could happen when the cpu writes to the compare register without knowing about the actual timer 2 count. secondly, and this is the most interesting advantage of the compare feature, the output pin is exclusively controlled by hardware therefore completely independent from any service delay which in real time applications could be disastrous. the compare interrupt in turn is not sensitive to such delays since it loads the parameters for the next event. this in turn is supposed to happen after a suff icient space of time. please note two special cases where a program using compare interrupts could show a surprising behavior : the first configuration has already been mentioned in the description of compare mode 1. the fact that the compare interrupts are transition activated becomes important when driving timer 2 with a slow external clock. in this case it should be carefully considered that the compare signal is active as long as the timer 2 count is equal to the contents of the corresponding compare register, and that the compare signal has a rising and a falling edge. furthermore, the shadow latches used in compare mode 1 are transparent while the compare signal is active. thus, with a slow input clock for timer 2, the comparator signal is active for a long time (= high number of machine cycles) and therefore a fast interrupt controlled reload of the compare register could not only change the shadow latch - as probably intended - but also the output buffer. when using the crc, you can select whether an interrupt should be generated when the compare signal goes active or inactive, depending on the status of bit i3fr in t2con. initializing the interrupt to be negative transition triggered is advisable in the above case. then the compare signal is already inactive and any write access to the port latch just changes the contents of the shadow-latch. please note that for cc registers 1 to 3 an interrupt is always requested when the compare signal goes active.
semiconductor group 6-38 on-chip peripheral components c515 the second configuration which should be noted is when compare function is combined with negative transition activated interrupts. lf the port latch of port p1.0 contains a 1, the interrupt request flags iex3 will immediately be set after enabling the compare mode for the crc register. the reason is that first the external interrupt input is controlled by the pins level. when the compare option is enabled the interrupt logic input is switched to the internal compare signal, which carries a low level when no true comparison is detected. so the interrupt logic sees a 1-to-0 edge and sets the interrupt request flag. an unintentional generation of an interrupt during compare initialization can be prevented lf the request flag is cleared by software after the compare is activated and before the external interrupt is enabled.
semiconductor group 6-39 on-chip peripheral components c515 6.2.2.5 capture function each of the compare/capture registers cc1 to cc3 and the crc register can be used to latch the current 16-bit value of the timer 2 registers tl2 and th2. two different modes are provided for this function. in mode 0, an external event latches the timer 2 contents to a dedicated capture register. in mode 1, a capture will occur upon writing to the low order byte of the dedicated 16-bit capture register. this mode is provided to allow the software to read the timer 2 contents on-the-fly. in mode 0, the external event causing a capture is : C for cc registers 1 to 3: a positive transition at pins cc1 to cc3 of port 1 C for the crc register: a positive or negative transition at the corresponding pin, depending on the status of the bit i3fr in sfr t2con. lf the edge flag is cleared, a capture occurs in response to a negative transition; lf the edge flag is set a capture occurs in response to a positive transition at pin p1.0 / int3 / cc0. in both cases the appropriate port 1 pin is used as input and the port latch must be programmed to contain a one (1). the external input is sampled in every machine cycle. when the sampled input shows a low (high) level in one cycle and a high (low) in the next cycle, a transition is recognized. the timer 2 contents is latched to the appropriate capture register in the cycle following the one in which the transition was identified. in mode 0 a transition at the external capture inputs of registers cc1 to cc3 will also set the corresponding external interrupt request flags iex3 to iex6. lf the interrupts are enabled, an external capture signal will cause the cpu to vector to the appropriate interrupt service routine. in mode 1 a capture occurs in response to a write instruction to the low order byte of a capture register. the write-to-register signal (e.g. write-to-crcl) is used to initiate a capture. the value written to the dedicated capture register is irrelevant for this function. the timer 2 contents will be latched into the appropriate capture register in the cycle following the write instruction. in this mode no interrupt request will be generated. figure 6-21 illustrates the operation of the crc register, while figure 6-22 shows the operation of the compare/capture registers 1 to 3. the two capture modes can be established individually for each capture register by bits in sfr ccen (compare/capture enable register). that means, in contrast to the compare modes, it is possible to simultaneously select mode 0 for one capture register and mode 1 for another register.
semiconductor group 6-40 on-chip peripheral components c515 figure 6-21 timer 2 - capture with register crc figure 6-22 timer 2 - capture with registers cc1 to cc3 mcs01909 mode 1 iex3 0 mode tf2 crch crcl capture th2 tl2 input clock external interrupt request timer 2 interrupt request 3 t2 con.6 crcl" "write to cc0 3/ p1.0/int mcs01910 mode 1 iex4 0 mode tf2 cch1 ccl1 capture th2 tl2 input clock external interrupt 4 request timer 2 interrupt request ccl1" "write to cc1 4/ p1.1/int
semiconductor group 6-41 on-chip peripheral components c515 6.3 serial interface the serial port of the c515 is full duplex, meaning it can transmit and receive simultaneously. it is also receive-buffered, meaning it can commence reception of a second byte before a previously received byte has been read from the receive register (however, if the first byte still hasnt been read by the time reception of the second byte is complete, one of the bytes will be lost). the serial port receive and transmit registers are both accessed at special function register sbuf. writing to sbuf loads the transmit register, and reading sbuf accesses a physically separate receive register. the serial port can operate in 4 modes (one synchronous mode, three asynchronous modes). the baud rate clock for the serial port is derived from the oscillator frequency (mode 0, 2) or generated either by timer 1 or by a dedicated baud rate generator (mode 1, 3). mode 0, shift register (synchronous) mode: serial data enters and exits through rxd. txd outputs the shift clock. 8 data bits are transmitted/ received: (lsb first). the baud rate is fixed at 1/12 of the oscillator frequency. (see section 6.3.4 for more detailed information) mode 1, 8-bit uart, variable baud rate: 10 bits are transmitted (through txd) or received (through rxd): a start bit (0), 8 data bits (lsb first), and a stop bit (1). on receive, the stop bit goes into rb8 in special function register scon. the baud rate is variable. (see section 6.3.5 for more detailed information) mode 2, 9-bit uart, fixed baud rate: 11 bits are transmitted (through txd) or received (through rxd): a start bit (0), 8 data bits (lsb first), a programmable 9th bit, and a stop bit (1). on transmit, the 9th data bit (tb8 in scon) can be assigned to the value of 0 or 1. or, for example, the parity bit (p, in the psw) could be moved into tb8. on receive, the 9th data bit goes into rb8 in special function register scon, while the stop bit is ignored. the baud rate is programmable to either 1/32 or 1/64 of the oscillator frequency. (see section 6.3.6 for more detailed information) mode 3, 9-bit uart, variable baud rate: 11 bits are transmitted (through txd) or received (through rxd): a start bit (0), 8 data bits (lsb first), a programmable 9th data bit, and a stop bit (1). in fact, mode 3 is the same as mode 2 in all respects except the baud rate. the baud rate in mode 3 is variable. (see section 6.3.6 for more detailed information) in all four modes, transmission is initiated by any instruction that uses sbuf as a destination register. reception is initiated in mode 0 by the condition ri = 0 and ren = 1. reception is initiated in the other modes by the incoming start bit if ren = 1. the serial interfaces also provide interrupt requests when a transmission or a reception of a frame has completed. the corresponding interrupt request flags for serial interface 0 are ti or ri, resp. see chapter 7 of this user manual for more details about the interrupt structure. the interrupt request flags ti and ri can also be used for polling the serial interface 0 if the serial interrupt is not to be used (i.e. serial interrupt 0 not enabled).
semiconductor group 6-42 on-chip peripheral components c515 6.3.1 multiprocessor communication modes 2 and 3 have a special provision for multiprocessor communications. in these modes, 9 data bits are received. the 9th one goes into rb8. then a stop bit follows. the port can be programmed such that when the stop bit is received, the serial port interrupt will be activated only if rb8 = 1. this feature is enabled by setting bit sm2 in scon. a way to use this feature in multiprocessor systems is as follows. when the master processor wants to transmit a block of data to one of several slaves, it first sends out an address byte which identifies the target slave. an address byte differs from a data byte in that the 9th bit is 1 in an address byte and 0 in a data byte. with sm2 = 1, no slave will be interrupted by a data byte. an address byte, however, will interrupt all slaves, so that each slave can examine the received byte and see if it is beeing addressed. the addressed slave will clear its sm2 bit and prepare to receive the data bytes that will be coming. the slaves that weren't being addressed leave their sm2s set and go on about their business, ignoring the incoming data bytes. sm2 has no effect in mode 0. sm2 can be used in mode 1 to check the validity of the stop bit. in a mode 1 reception, if sm2 = 1, the receive interrupt will not be activated unless a valid stop bit is received. 6.3.2 serial port registers the serial port control and status register is the special function register scon. this register contains not only the mode selection bits, but also the 9th data bit for transmit and receive (tb8 and rb8), and the serial port interrupt bits (ti and ri). sbuf is the receive and transmit buffer of serial interface 0. writing to sbuf loads the transmit register and initiates transmission. reading out sbuf accesses a physically separate receive register.
semiconductor group 6-43 on-chip peripheral components c515 special function register scon (address 98 h ) reset value : 00 h special function register sbuf (address 99 h ) reset value : xx h bit function sm0 sm1 serial port 0 operating mode selection bits sm2 enable serial port multiprocessor communication in modes 2 and 3 in mode 2 or 3, if sm2 is set to 1 then ri0 will not be activated if the received 9th data bit (rb8) is 0. in mode 1, if sm2 = 1 then ri will not be activated if a valid stop bit was not received. in mode 0, sm2 should be 0. ren serial port receiver enable enables serial reception. set by software to enable serial reception. cleared by software to disable serial reception. tb8 serial port transmitter bit 9 tb8 is the 9th data bit that will be transmitted in modes 2 and 3. set or cleared by software as desired. rb8 serial port receiver bit 9 in modes 2 and 3, rb8 is the 9th data bit that was received. in mode 1, if sm2 = 0, rb8 is the stop bit that was received. in mode 0, rb8 is not used. ti serial port transmitter interrupt flag ti is set by hardware at the end of the 8th bit time in mode 0, or at the beginning of the stop bit in the other modes, in any serial transmission. ti must be cleared by software. ri serial port receiver interrupt flag ri is set by hardware at the end of the 8th bit time in mode 0, or halfway through the stop bit time in the other modes, in any serial reception (exception see sm2). ri must be cleared by software. 9f h 9e h 9d h 9c h 9b h 9a h 99 h 98 h sm0 sm1 sm2 ren 98 h scon bit no. msb lsb tb8 rb8 ti ri 99 h sbuf 76543210 serial interface buffer register sm0 sm1 selected operating mode 0 0 serial mode 0 : shift register, fixed baud rate ( f osc /12) 0 1 serial mode 1 : 8-bit uart, variable baud rate 1 0 serial mode 2 : 9-bit uart, fixed baud rate ( f osc /32 or f osc /64) 1 1 serial mode 3 : 9-bit uart, variable baud rate
semiconductor group 6-44 on-chip peripheral components c515 6.3.3 baud rate generation there are several possibilities to generate the baud rate clock for the serial port depending on the mode in which it is operating. for clarification some terms regarding the difference between "baud rate clock" and "baud rate" should be mentioned. the serial interface requires a clock rate which is 16 times the baud rate for internal synchronization. therefore, the baud rate generators have to provide a "baud rate clock" to the serial interface which - there divided by 16 - results in the actual "baud rate". however, all formulas given in the following section already include the factor and calculate the final baud rate. further, the abrevation f osc refers to the external clock frequency (oscillator or external input clock operation). the baud rate of the serial port is controlled by two bits which are located in the special function registers as shown below. special function register adcon (address d8 h ) reset value : 00x00000 b special function register pcon (address 87 h ) reset value : 000x0000 b figure 6-23 shows the configuration for the baud rate generation of the serial port. bit function bd baud rate generator enable when set, the baud rate of serial interface 0 is derived from a dedicated prescaler. when cleared (default after reset), baud rate is derived from the timer 1 overflow rate. smod double baud rate when set, the baud rate of the serial interface in modes 1, 2, and 3 is doubled. after reset this bit is cleared. smod pds idls sd 1) 87 h pcon bit no. msb lsb gf1 gf0 pde idle 76543210 the shaded bits are not used in controlling the serial port baud rate . bd clk C bsy d8 h adcon adm mx2 mx1 mx0 df h de h dd h dc h db h da h d9 h d8 h 1) this bit is available for c515-lm/1rm versions only.
semiconductor group 6-45 on-chip peripheral components c515 figure 6-23 baud rate generation for the serial port depending on the programmed operating mode different paths are selected for the baud rate clock generation. figure 6-23 shows the dependencies of the serial port 0 baud rate clock generation from the two control bits and from the mode which is selected in the special function register scon. 6.3.3.1 baud rate in mode 0 the baud rate in mode 0 is fixed to : 6.3.3.2 baud rate in mode 2 the baud rate in mode 2 depends on the value of bit smod in special function register pcon. if smod = 0 (which is the value after reset), the baud rate is 1/64 of the oscillator frequency. if smod = 1, the baud rate is 1/32 of the oscillator frequency. mcb03206 rate f osc (smod) baud clock pcon.7 2 (sm0/ sm1) scon.7 scon.6 only one mode can be selected adcon.7 (bd) 0 1 0 1 timer mode mode note: the switch configuration shows the reset state. 1 0 2 3 mode mode 1 overflow 6 /2 39 mode 0 baud rate = oscillator frequency 12 mode 2 baud rate = oscillator frequency 64 2 smod x
semiconductor group 6-46 on-chip peripheral components c515 6.3.3.3 baud rate in mode 1 and 3 in these modes the baud rate is variable and can be generated alternatively by a baud rate generator with a fixed prescaler or by timer 1. 6.3.3.3.1 using the baud rate generator in modes 1 and 3, the c515 can use the internal baud rate generator for the serial port. to enable this feature, bit bd (bit 7 of special function register adcon) must be set. this baud rate generator divides the oscillator frequency by 2 x 39=78. bit smod (pcon.7) also can be used to enable a divide by 2 prescaler. for baud rate calculation the baud rate clock must be further divided by 16. therefore, at 12 mhz oscillator frequency, the commonly used baud rates 4800 baud (smod=0) and 9600 (smod=1) are available (with 0.16 % deviation). the baud rate is determined by smod and the oscillator frequency as follows : 6.3.3.3.2 using timer 1 to generate baud rates in mode 1 and 3 of the serial port also timer 1 can be used for generating baud rates. to enable this feature, bit bd (bit 7 of special function register adcon) must be reset.then the baud rate is determined by the timer 1 overflow rate and the value of smod as follows : the timer 1 interrupt is usually disabled in this application. timer 1 itself can be configured for either "timer" or "counter" operation, and in any of its operating modes. in most typical applications, it is configured for "timer" operation in the auto-reload mode (high nibble of tmod = 0010 b ). in this case the baud rate is given by the formula: very low baud rates can be achieved with timer 1 if leaving the timer 1 interrupt enabled, configuring the timer to run as 16-bit timer (high nibble of tmod = 0001 b ), and using the timer 1 interrupt for a 16-bit software reload. table 6-5 lists various commonly used baud rates of the different modes. it also shows how these baud rates can be obtained using timer 1 in mode 1 or 3. mode 1,3 baud rate = oscillator frequency 2496 2 smod x mode 1, 3 baud rate = (timer 1 overflow rate) 32 2 smod x mode 1, 3 baud rate = 32 x 12 x (256 C (th1)) 2 smod x oscillator frequency
semiconductor group 6-47 on-chip peripheral components c515 table 6-5 timer 1 generated commonly used baud rates baud rate f osc (mhz) smod bd timer 1 mode reload value mode 1, 3: 62.5 kbaud 125 kbaud 19.5 kbaud 9.6 kbaud 4.8 kbaud 2.4 kbaud 1.2 kbaud 110 baud 110 baud 4.8 kbaud 9.6 kbaud 6.4 kbaud 12.8 kbaud 9.6 kbaud 19.2 kbaud 12.0 24.0 11.059 11.059 11.059 11.059 11.059 6.0 12.0 12.0 12.0 16.0 16.0 24.0 24.0 1 1 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 2 2 2 2 2 1 - - - - - - ff h ff h fd h fd h fa h f4 h e8 h 72 h feeb h - - - - - - mode 0 : 1 mbaud 1.33 mbaud 2 mbaud 12.0 16.0 24.0 - - - - - - - - - - - - mode 2 : 187.5 kbaud 375 kbaud 250 kbaud 500 kbaud 375 kbaud 750 kbaud 12.0 12.0 16.0 16.0 24.0 24.0 0 1 0 1 0 1 - - - - - - - - - - - - - - - - - -
semiconductor group 6-48 on-chip peripheral components c515 6.3.4 details about mode 0 serial data enters and exists through rxd. txd outputs the shift clock. 8 data bits are transmitted/ received: (lsb first). the baud rate is fixed at f osc /12. figure 6-24 shows a simplified functional diagram of the serial port in mode 0. the associated timing is illustrated in figure 6-25 . transmission is initiated by any instruction that uses sbuf as a destination register. the "write-to- sbuf" signal at s6p2 also loads a 1 into the 9th position of the transmit shift register and tells the tx control block to commence a transmission. the internal timing is such that one full machine cycle will elapse between "write-to-sbuf", and activation of send. send enables the output of the shift register to the alternate output function line of p3.0, and also enables shift clock to the alternate output function line of p3.1. shift clock is low during s3, s4, and s5 of every machine cycle, and high during s6, s1 and s2. at s6p2 of every machine cycle in which send is active, the contents of the transmit shift register are shifted one position to the right. as data bits shift out to the right, zeroes come in from the left. when the msb of the data byte is at the output position of the shift register, then the1 that was initially loaded into the 9th position, is just left of the msb, and all positions to the left of that contain zeroes. this condition flags the tx control block to do one last shift and then deactivate send and set ti. both of these actions occur at s1p1 of the 10th machine cycle after "write-to-sbuf". reception is initiated by the condition ren = 1 and ri = 0. at s6p2 of the next machine cycle, the rx control unit writes the bits 1111 1110 to the receive shift register, and in the next clock phase activates receive. receive enables shift clock to the alternate output function line of p3.1. shift clock makes transitions at s3p1 and s6p1 of every machine cycle. at s6p2 of every machine cycle in which receive is active, the contents of the receive shift register are shifted one position to the left. the value that comes in from the right is the value that was sampled at the p3.0 pin at s5p2 of the same machine cycle. as data bit comes in from the right, 1s shift out to the left. when the 0 that was initially loaded into the rightmost position arrives at the leftmost position in the shift register, it flags the rx control block to do one last shift and load sbuf. at s1p1 of the 10th machine cycle after the write to scon that cleared ri, receive is cleared and ri is set.
semiconductor group 6-49 on-chip peripheral components c515 figure 6-24 serial interface, mode 0, functional diagram mcs02101 internal bus 1 sbuf zero detector d s clk q shift send 1 tx control start tx clock ti rx control start ri receive shift serial port interrupt input shift register sbuf internal bus write to sbuf shift load sbuf read sbuf rxd p3.0 alt. output function function output p3.1 alt. txd 1 shift clock & ren ri s6 rx clock function input p3.0 alt. rxd 0 1 111111 & & shift baud rate clock _ < _ < baud rate clock
semiconductor group 6-50 on-chip peripheral components c515 figure 6-25 serial interface, mode 0, timing diagram s 12 s 3 s 4 s 5 s 6 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s d0 d1 d2 d3 d4 d5 d6 d7 ale write to sbuf send shift rxd (data out) s6p2 txd (shift clock) s3p1 s6p1 write to scon (clear ri) shift receive ri rxd (data in) txd (shift clock) d0 d1 d2 d3 d4 d5 d6 d7 s5p ti mct02102 receive transmit
semiconductor group 6-51 on-chip peripheral components c515 6.3.5 details about mode 1 ten bits are transmitted (through txd), or received (through rxd): a start bit (0), 8 data bits (lsb first), and a stop bit (1). on receive, the stop bit goes into rb8 in scon. the baud rate is determined either by the timer 1 overflow rate or by the internal baud rate generator. figure 6-26 shows a simplified functional diagram of the serial port in mode 1. the associated timings for transmit/receive are illustrated in figure 6-27 . transmission is initiated by an instruction that uses sbuf as a destination register. the "write-to- sbuf" signal also loads a 1 into the 9th bit position of the transmit shift register and flags the tx control unit that a transmission is requested. transmission starts at the next rollover in the divide- by-16 counter. (thus, the bit times are synchronized to the divide-by-16 counter, not to the "write- to-sbuf" signal). the transmission begins with activation of send , which puts the start bit at txd. one bit time later, data is activated, which enables the output bit of the transmit shift register to txd. the first shift pulse occurs one bit time after that. as data bits shift out to the right, zeroes are clocked in from the left. when the msb of the data byte is at the output position of the shift register, then the 1 that was initially loaded into the 9th position is just to the left of the msb, and all positions to the left of that contain zeroes. this condition flags the tx control unit to do one last shift and then deactivate send and set ti. this occurs at the 10th divide-by-16 rollover after "write-to-sbuf". reception is initiated by a detected 1-to-0 transition at rxd. for this purpose rxd is sampled at a rate of 16 times whatever baud rate has been established. when a transition is detected, the divide- by-16 counter is immediately reset, and 1ff h is written into the input shift register, and reception of the rest of the frame will proceed. the 16 states of the counter divide each bit time into 16ths. at the 7th, 8th and 9th counter states of each bit time, the bit detector samples the value of rxd. the value accepted is the value that was seen in at latest 2 of the 3 samples. this is done for the noise rejection. if the value accepted during the first bit time is not 0, the receive circuits are reset and the unit goes back to looking for another 1-to-0 transition. this is to provide rejection or false start bits. if the start bit proves valid, it is shifted into the input shift register, and reception of the rest of the frame will proceed. as data bits come in from the right, 1s shift out to the left. when the start bit arrives at the leftmost position in the shift register, (which in mode 1 is a 9-bit register), it flags the rx control block to do one last shift, load sbuf and rb8, and set ri. the signal to load sbuf and rb8, and to set ri, will be generated if, and only if, the following conditions are met at the time the final shift pulse is generated. 1) ri = 0, and 2) either sm2 = 0, or the received stop bit = 1 if one of these two condtions is not met, the received frame is irretrievably lost. if both conditions are met, the stop bit goes into rb8, the 8 data bit goes into sbuf, and ri is activated. at this time, whether the above conditions are met or not, the unit goes back to looking for a 1-to-0 transition in rxd.
semiconductor group 6-52 on-chip peripheral components c515 figure 6-26 serial interface, mode 1, functional diagram mcs02103 internal bus 1 sbuf zero detector d s clk q data send 1-to-0 transition detector tx control shift start tx clock rx control start load shift sbuf sample bit detector (9bits) input shift register 1ff sbuf internal bus write to sbuf txd baud rate clock rxd shift load sbuf read sbuf 1 & 16 16 rx interrupt port serial 1 ti ri h _ < _ <
semiconductor group 6-53 on-chip peripheral components c515 figure 6-27 serial interface, mode 1, timing diagram mct02104 to sbuf d7 stop bit d6 d5 d4 d3 d2 d1 d0 start bit ti txd shift data s1p1 send d0 start bit d1 d2 d3 d4 d5 d6 d7 stop bit 16 reset receive transmit write tx clock clock rx rxd sample times bit detector shift ri
semiconductor group 6-54 on-chip peripheral components c515 6.3.6 details about modes 2 and 3 eleven bits are transmitted (through txd), or received (through rxd): a start bit (0), 8 data bits (lsb first), a programmable 9th data bit, and a stop bit (1). on transmit, the 9th data bit (tb8) can be assigned the value of 0 or 1. on receive, the 9th data bit goes into rb8 in scon. the baud rate is generated by either using timer 1 or the internal baud rate generator. figure 6-28 shows a functional diagram of the serial port in modes 2 and 3. the receive portion is exactly the same as in mode 1. the transmit portion differs from mode 1 only in the 9th bit of the transmit shift register. the associated timings for transmit/receive are illustrated in figure 6-29 . transmission is initiated by any instruction that uses sbuf as a destination register. the "write-to- sbuf" signal also loads tb8 into the 9th bit position of the transmit shift register and flags the tx control unit that a transmission is requested. transmission starts at the next rollover in the divide- by-16 counter. (thus, the bit times are synchronized to the divide-by-16 counter, not to the "write- to-sbuf" signal.) the transmission begins with activation of send, which puts the start bit at txd. one bit time later, data is activated, which enables the output bit of the transmit shift register to txd. the first shift pulse occurs one bit time after that. the first shift clocks a 1 (the stop bit) into the 9th bit position of the shift register. thereafter, only zeroes are clocked in. thus, as data bits shift out to the right, zeroes are clocked in from the left. when tb8 is at the output position of the shift register, then the stop bit is just to the left of tb8, and all positions to the left of that contain zeroes. this condition flags the tx control unit to do one last shift and then deactivate send and set ti. this occurs at the 11th divide-by-16 rollover after "write-to-sbuf". reception is initiated by a detected 1-to-0 transition at rxd. for this purpose rxd is sampled at a rate of 16 times whatever baud rate has been established. when a transition is detected, the divide- by-16 counter is immediately reset, and 1ff h is written to the input shift register. at the 7th, 8th and 9th counter states of each bit time, the bit detector samples the value of rxd. the value accepted is the value that was seen in at least 2 of the 3 samples. if the value accepted during the first bit time is not 0, the receive circuits are reset and the unit goes back to looking for another 1-to-0 transition. if the start bit proves valid, it is shifted into the input shift register, and reception of the rest of the frame will proceed. as data bit come from the right, 1s shift out to the left. when the start bit arrives at the leftmost position in the shift register (which in modes 2 and 3 is a 9-bit register), it flags the rx control block to do one last shift, load sbuf and rb8, and to set ri. the signal to load sbuf and rb8, and to set ri, will be generated if, and only if, the following conditions are met at the time the final shift pulse is generated: 1) ri = 0, and 2) either sm2 = 0 or the received 9th data bit = 1 if either of these conditions is not met, the received frame is irretrievably lost, and ri is not set. if both conditions are met, the received 9th data bit goes into rb8, and the first 8 data bit goes into sbuf. one bit time later, whether the above conditions were met or not, the unit goes back to looking for a 1-to-0 transition at the rxd input. note that the value of the received stop bit is irrelevant to sbuf, rb8 or ri.
semiconductor group 6-55 on-chip peripheral components c515 figure 6-28 serial interface, mode 2 and 3, functional diagram mcs02105 internal bus tb8 sbuf zero detector d s clk q data send 1-to-0 transition detector 1 16 tx control shift start tx clock ti rx control start ri load shift sbuf rx clock serial port interrupt sample bit detector (9bits) input shift register 1ff sbuf internal bus write to sbuf txd baud rate clock rxd shift load sbuf read sbuf & 1 16 stop bit generation _ < _ <
semiconductor group 6-56 on-chip peripheral components c515 figure 6-29 serial interface, mode 2 and 3, timing diagram mct02587 write to sbuf tx clock d7 tb8 stop bit d6 d5 d4 d3 d2 d1 d0 start bit stop bit gen. ti txd shift data mode 2 : s6p1 send rx clock rx d0 start bit d1 d2 d3 d4 d5 d6 d7 rb8 stop bit bit detector sample times shift ri 16 reset receive transmit mode 3 : s1p1
semiconductor group 6-57 on-chip peripheral components c515 6.4 a/d converter the c515 provides an a/d converter with the following features: C 8 multiplexed input channels C the possibility of using the analog inputs (port 6) also as digital inputs C programmable internal reference voltages (16 steps each) via resistor array C 8-bit resolution within the selected reference voltage range C internal start-of-conversion trigger C interrupt request generation after each conversion for the conversion, the method of successive approximation via capacitor array is used. the externally applied reference voltage range has to be held on a fixed value within the specifications (see section "a/d converter characteristics" in chapter 10). the internal reference voltages can be varied to reduce the reference voltage range of the a/d converter and thus to achieve a higher resolution. figure 6-30 shows a block diagram of the a/d converter. 6.4.1 a/d converter operation an internal start of a single a/d conversion is triggered by a write-to-dapr instruction. when single conversion mode is selected (bit adm=0) only one a/d conversion is performed. in continuous mode (bit adm=1), after completion of an a/d conversion a new a/d conversion is triggered automatically until bit adm is reset. the busy flag bsy (adcon.4) is automatically set when an a/d conversion is in progress. after completion of the conversion it is reset by hardware. this flag can be read only, a write has no effect. the interrupt request flag iadc (ircon.0) is set when an a/d conversion is completed. the bits mx0 to mx2 in special function register adcon are used for selection of the analog input channel. port 6 is a dual purpose input port. lf the input voltage meets the specified logic levels, it can also be used as digital inputs regardless of whether the pin levels are sampled by the a/d converter at the same time.
semiconductor group 6-58 on-chip peripheral components c515 figure 6-30 a/d converter block diagram mcb03207 .1 .2 .3 .4 .5 .6 msb (d9 ) h a/d addat single/ continuous mode start of conversion mux s & h 4 conversion clock f adc osc f port 6 shaded bit locations are not used in adc-functions. in f input clock write to converter internal bus internal bus /2 v agnd aref v .7 .6 .3 .4 .5 h dapr (da ) .2 .1 .0 dapr v intaref intagnd v internal reference voltages programming of intaref v intagnd v programming of lbs ex5 iex5 bsy _ iex6 ex6 iadc mx0 mx2 iex3 adm iex4 mx1 0 eadc ex3 ex4 ecan adcon (d8 ) ircon (c0 ) bd clk h exf2 tf2 h ien1 (b8 ) exen2 swdt h
semiconductor group 6-59 on-chip peripheral components c515 6.4.2 a/d converter registers this section describes the bits/functions of the registers which are used by the a/d converter. C adcon (a/d converter control register) C addat (a/d converter data register) C ien1 and ircon (a/d converter interrupt control bits) C dapr (d/a converter program register) for the programmable reference voltages. 6.4.2.1 a/d converter control register adcon special function register adcon which is is used to set the operating modes, to check the status, and to select one of eight analog input channels. special function register adcon (address d8 h ) ) reset value : 00x00000 b bit function bsy busy flag this flag indicates whether a conversion is in progress (bsy = 1). the flag is set by hardware during an a/d conversion and cleared by hardware when the conversion is completed. adm a/d conversion mode when set, a continuous a/d conversion is selected. if cleared during a running a/d conversion, the conversion is stopped after current conversion process is completed. mx2 - mx0 a/d converter input channel select bits bits mx2-0 are used for selection of the analog input channels.the analog inputs are selected according to the following table : 76543210 C bsy adm mx2 mx1 mx0 d8 h adcon bit no. msb lsb clk bd the shaded bits are not used for a/d converter control. mx2 mx1 mx0 selected analog input 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 p6.0 / ain0 p6.1 / ain1 p6.2 / ain2 p6.3 / ain3 p6.4 / ain4 p6.5 / ain5 p6.6 / ain6 p6.7 / ain7
semiconductor group 6-60 on-chip peripheral components c515 note :generally, before entering the power-down mode, an a/d conversion in progress must be stopped. if a single a/d conversion is running, it must be terminated by polling the bsy bit or waiting for the a/d conversion interrupt. in continuous conversion mode, bit adm must be cleared and the last a/d conversion must be terminated before entering the power-down mode. a single a/d conversion is started by writing to sfr addat with dummy data. a continuous conversion is started under the following conditions : C by setting bit adm during a running single a/d conversion C by setting bit adm when at least one a/d conversion has occured after the last reset operation. C by writing addat with dummy data after bit adm has been set before (if no a/d conversion has occured after the last reset operation). when bit adm is reset by software in continuous conversion mode, the just running a/d conversion is stopped after its end. 6.4.2.2 a/d converter data register addat this register holds the result of the 8-bit conversion. the most significant bit of the 8-bit conversion result is bit 7 and the least significant bit is bit 0 of the addat register. the data remains in addat until it is overwritten by the next converted data. addat can be read or written under software control. if the a/d converter of the c515 is not used, register addat can be used as an additional general purpose register. special function register addat (address d9 h ) reset value : 00 h 76543210 d9 h addat bit no. msb lsb .7 .6 .5 .4 .3 .2 .1 .0
semiconductor group 6-61 on-chip peripheral components c515 6.4.2.3 a/d converter interrupt control bits in ien1 and ircon the a/d converter interrupt is controlled by bits which are located in the sfrs ien1 and ircon. special function register ien1 (address b8 h ) reset value : 00 h special function register ircon (address c0 h ) reset value : 00 h bit function eadc enable a/d converter interrupt if eadc = 0, the a/d converter interrupt is disabled. iadc a/d converter interrupt request flag set by hardware at the end of an a/d conversion. must be cleared by software. c7 h c6 h c5 h c4 h c3 h c2 h c1 h c0 h iex6 iex5 iex4 iex3 iex2 iadc c0 h ircon tf2 exf2 exen2 swdt ex6 ex5 b8 h ien1 bit no. bf h msb lsb ex4 ex3 ecan eadc be h bd h bc h bb h ba h b9 h b8 h the shaded bits are not used for a/d converter control.
semiconductor group 6-62 on-chip peripheral components c515 6.4.2.4 programmable reference voltages of the a/d converter (dapr register) the c515 has two pins to which a reference voltage range for the on-chip a/d converter is applied (pin v aref for the upper voltage and pin v agnd for the lower voltage). in contrast to conventional a/ d converters it is now possible to use not only these externally applied reference voltages for the conversion but also internally generated reference voltages which are derived from the externally applied ones. for this purpose a resistor ladder provides 16 equidistant voltage levels between v aref and v agnd . these steps can individually be assigned as upper and lower reference voltage for the converter itself. these internally generated reference voltages are called v lntaref and v lntagnd . the internal reference voltage programming can be thought of as a programmable "d/a converter" which provides the voltages v intarff and v intagnd for the a/d converter itself. special function register dapr (address da h ) ) reset value : 00 h any write-access to dapr starts conversion. the sfr dapr is provided for programming the internal reference voltages v intaref and v lntagnd . for this purpose the internal reference voltages can be programmed in steps of 1/16 of the external reference voltages ( v aref C v agnd ) by four bits each in register dapr. bits 0 to 3 specify v lntagnd , while bits 4 to 7 specify v intaref . a minimum of 1 v difference is required between the internal reference voltages v lntarf and v intagnd for proper operation of the a/d converter. this means, for example, in the case where v aref is 5 v and v agnd is 0 v, there must be at least four steps difference between the internal reference voltages v intaref and v intagnd . the values of v intagnd and v intaref are given by the formulas: bit function dapr.7-.4 programming of v intaref these bits are used for adjustment of the internal v intaref voltage. dapr.3-.0 programming of v intagnd these bits are used for adjustment of the internal v intagnd voltage. 76543210 .5 .4 .3 .2 .1 .0 da h dapr bit no. msb lsb .6 .7 v intagnd = v agnd + dapr.3-.0 16 ( v aref C v agnd ) with dapr.3-.0 < c h ; v intaref = v agnd + dapr.7-.4 16 ( v aref C v agnd ) with dapr.7-.4 > 3 h ;
semiconductor group 6-63 on-chip peripheral components c515 dapr.3-.0 is the contents of the low-order nibble, and dapr.7-.4 the contents of the high-order nibble of dapr. if dapr.3-.0 or dapr.7-.4 = 0, the internal reference voltages correspond to the external reference voltages v agnd and v aref , respectively. if v ainput > v intaref , the conversion result is ff h , if v ainput < v intagdn , the conversion result is 00 h ( v ainput is the analog input voltage). if the external reference voltages v agnd = 0 v and v aref = +5 v (with respect to v ss and v cc ) are applied, then the following internal reference voltages v intagnd and v intaref shown in table 6-6 can be adjusted via the special function register dapr. table 6-6 adjustable internal reference voltages the programmability of the internal reference voltages allows adjusting the internal voltage range to the range of the external analog input voltage or it may be used to increase the resolution of the converted analog input voltage by starting a second conversion with a compressed internal reference voltage range close to the previously measured analog value. figures 7-30 and 7-31 illustrate these applications. step dapr (.3-.0) dapr (.7-.4) v intagnd v intaref 0 0000 0.0 5.0 1 0001 0.3125 C 2 0010 0.625 C 3 0011 0.9375 C 4 0100 1.25 1.25 5 0101 1.5625 1.5625 6 0110 1.875 1.875 7 0111 2.1875 2.1875 8 1000 2.5 2.5 9 1001 2.8125 2.8125 10 1010 3.125 3.125 11 1011 3.4375 3.4375 12 1100 3.75 3.75 13 1101 C 4.0625 14 1110 C 4.375 15 1111 C 4.68754
semiconductor group 6-64 on-chip peripheral components c515 figure 6-31 adjusting the internal reference voltages within range of the external analog input voltages figure 6-32 increasing the resolution by a second conversion mca01899 an0 an1 an.. v v aref agnd v 4.375 2.5 3.125 0.625 1.25 2.5 intaref v v intagnd 5.00 0v v v v v v v mca01900 intaref v v intagnd 3.125 1.875 sample time time sample first conversion 20 mv resolution 5 mv resolution second conversion v 0 5.00 v agnd aref v v v v
semiconductor group 6-65 on-chip peripheral components c515 the external reference voltage supply need only be applied when the a/d converter is used, otherwise the pins v aref and v agnd may be left unconnected. the reference voltage supply has to meet some requirements concerning the level of v agnd and v aref and the output impedance of the supply voltage (see also "a/d converter characteristics" in the data sheet). C the voltage v aref must meet the following specification : v aref = v cc + 0.25 v C the voltage v agnd must meet a similar specification : v agnd = v ss + 0.2 v C the differential output impedance of the analog reference supply voltage should be less than 1 k w. lf the above mentioned operating conditions are not met the accuracy of the converter may be decreased. furthermore, the analog input voltage v ainput must not exceed the range from ( v agnd C 0.2 v) to ( v aref + 0.2 v). otherwise, a static input current might result at the corresponding analog input which will also affect the accuracy of the other input channels.
semiconductor group 6-66 on-chip peripheral components c515 6.4.3 a/d conversion timing an a/d conversion is internally started by writing the sfr dapr. a write to sfr dapr will start a new conversion even if a conversion is currently in progress. the conversion begins with the next machine cycle, and the bsy flag in sfr adcon will be set. the a/d conversion procedure is divided into three parts : C sample phase (t s ), used for sampling the analog input voltage. C conversion phase (t co ), used for the real a/d conversion. C write result phase (t wr ), used for writing the conversion result into the addat register. sample time t s : during this time the internal capacitor array is connected to the selected analog input channel and is loaded with the analog voltage to be converted. the analog voltage is internally fed to a voltage comparator. with beginning of the sample phase the bsy bit in sfr adcon is set. conversion time t co : during the conversion time the analog voltage is converted into a 8-bit digital value using the successive approximation technique with a binary weighted capacitor network. write result time t wr : at the result phase the conversion result is written into the addat register. the total a/d conversion time is defined by t adcc which is the sum of the two phase times t s and t co . the duration of the three phases of an a/d conversion is specified as shown in figure 6-33 . this figure also shows how an a/d conversion is embedded into the microcontroller cycle scheme using the relation 6 x t in = 1 instruction cycle. it also shows the behaviour of the busy flag (bsy) and the interrupt flag (iadc) during an a/d conversion.
semiconductor group 6-67 on-chip peripheral components c515 figure 6-33 a/d conversion timing mct03236 start of an a/d conversion into addat result is written write result phase conversion phase sample phase bsy bit a/d conversion time cycle time t co t adcc t s t adcc = t s + t co =40 t in +32 t in =72 t in with t in =2x t clcl t wr = t in t wr start of a/d conversion cycle start of next conversion (in continuous mode) write addat first instr. of an interrupt routine cont. conv. single conv. write result cycle mov a, addat 1 instruction cycle mov addat,#0 t adcc =80 t in a/d conversion cycle bsy bit iadc bit ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ x 1 2 3 4 5 11 12 13 14 15 16 x-1
semiconductor group 6-68 on-chip peripheral components c515 an a/d conversion is always started with the beginning of a processor cycle when it has been initiated by writing sfr addat. the addat write operation may take one or two machine cycles. in figure 6-33 , the instruction mov addat,#0 starts the a/d conversion (machine cycle x-1 and x). the total a/d conversion (sample and conversion phase) is finished with the beginning of the 14th machine cycle after the a/d conversion start. in the next machine cycle the conversion result is written into the addat register and can be read in the same cycle by an instruction (e.g. mov a,addat). if continuous conversion is selected (bit adm set), the next conversion is started with the beginning of the machine cycle which follows the write result cycle. the bsy bit is set at the beginning of the first a/d conversion machine cycle and reset at the beginning of the write result cycle. if continuous conversion is selected, bsy is again set with the beginning of the machine cycle which follows the write result cycle. this means that in continuous conversion mode bsy is not set for a complete machine cycle. therefore, in continuous conversion mode it is not recommended to poll the bsy bit using e.g. the jnb instruction. the interrupt flag iadc is set in the 12th instruction cycle of an a/d conversion. if the a/d converter interrupt is enabled and the a/d converter interrupt is priorized to be serviced immediately, the first instruction of the interrupt service routine will be executed in the next machine cycle which follows the write result cycle. iadc must be reset by software. depending on the application, typically there are three methods to handle the a/d conversion in the c515 : C software delay the machine cycles of the a/d conversion are counted and the program executes a software delay (e.g. nops) before reading the a/d conversion result in the write result cycle. this is the fastest method to get the result of an a/d conversion. C polling bsy bit the bsy bit is polled and the program waits until bsy=0. attention : a polling jb instruction which is two machine cycles long, possibly may not recognize the bsy=0 condition during the write result cycle in the continuous conversion mode. C a/d conversion interrupt after the start of an a/d conversion the a/d converter interrupt is enabled. the result of the a/d conversion is read in the interrupt service routine. if other c515 interrupts are enabled, the interrupt latency must be regarded. therefore, this software method is the slowest method to get the result of an a/d conversion. depending on the oscillator frequency of the c515 the total time of an a/d conversion is calculated according the formula given in figure 6-33 . table 6-7 shows some conversion times for typical clock rates. table 6-7 a/d conversion times f osc [mhz] t in [ns] total conversion time t adcc [ m s] 12 mhz 166.7 12 16 mhz 125 9 24 mhz 83.3 6
semiconductor group 7-1 interrupt system c515 7 interrupt system the c515 provides 12 interrupt sources with four priority levels. five interrupts can be generated by the on-chip peripherals (timer 0, timer 1, timer 2, a/d converter, and serial interface) and seven interrupts may be triggered externally (p3.2/int0 , p3.3/int1 , p1.4/int2 , p1.0/int3 , p1.1/int4, p1.2/int5, p1.3/int6). this chapter shows the interrupt structure, the interrupt vectors and the interrupt related special function registers. figure 7-1 and 7-2 give a general overview of the interrupt sources and illustrate the request and the control flags which are described in the next sections.
semiconductor group 7-2 interrupt system c515 figure 7-1 interrupt structure, overview part 1 mcs03208 bit addressable request flag is cleared by hardware ip1.0 h 0003 tcon.1 ien0.0 ie0 ex0 p3.2/ it0 tcon.0 ip0.0 highest priority level eadc iadc ien1.0 ircon.0 0043 h a/d converter ip1.2 ip0.2 timer 0 h 000b tcon.5 ien0.1 tf0 et0 overflow int0 int2 t2con.5 i2fr p1.4/ ex2 iex2 ien1.1 ircon.1 0053 h lowest priority level eal ien0.7 polling sequence 004b h ip0.1 ip1.1 int1 tcon.2 it1 p3.3/ ex1 ie1 ien0.2 tcon.3 0013 h ircon.2 ien1.2 iex3 ex3 p1.0/ i3fr t2con.6 int3 cc0
semiconductor group 7-3 interrupt system c515 figure 7-2 interrupt structure, overview part 2 mcs03209 bit addressable request flag is cleared by hardware ip1.3 h 001b ip0.3 highest priority level ex4 iex4 ien1.3 ircon.3 005b h ip1.5 ip0.5 timer 1 h 0023 tcon.7 ien0.3 tf1 et1 overflow es ri ien0.4 scon.0 006b h lowest priority level eal ien0.7 polling sequence 0063 h ip0.4 ip1.4 t2ex p1.5/ et2 ien0.5 002b h p1.3/ int6 cc3 cc1 int4 p1.1/ scon.1 ti 1 usart p1.2/ int5 cc2 ircon.4 ien1.4 iex5 ex5 ircon.6 tf2 exf2 ircon.7 ien1.7 exen2 ex6 iex6 ien1.5 ircon.5 2 overflow timer _ < _ < 1
semiconductor group 7-4 interrupt system c515 7.1 interrupt registers 7.1.1 interrupt enable registers each interrupt vector can be individually enabled or disabled by setting or clearing the corresponding bit in the interrupt enable registers ien0 and ien1. register ien0 also contains the global disable bit (eal), which can be cleared to disable all interrupts at once. generally, after reset all interrupt enable bits are set to 0. that means that the corresponding interrupts are disabled. the ien0 register contains the general enable/disable flags of the external interrupts 0 and 1, the timer interrupts, and the usart interrupt. special function register ien0 (address a8 h ) reset value : 00 h the shaded bit is not used for interrupt control. bit function eal enable/disable all interrupts. if eal=0, no interrupt will be acknowledged. if eal=1, each interrupt source is individually enabled or disabled by setting or clearing its enable bit. et2 timer 2 overflow / external reload interrupt enable. if et2 = 0, the timer 2 interrupt is disabled. if et2 = 1, the timer 2 interrupt is enabled. es serial channel (usart) interrupt enable if es = 0, the serial channel interrupt 0 is disabled. if es = 1, the serial channel interrupt 0 is enabled. et1 timer 1 overflow interrupt enable. if et1 = 0, the timer 1 interrupt is disabled. if et1 = 1, the timer 1 interrupt is enabled. ex1 external interrupt 1 enable. if ex1 = 0, the external interrupt 1 is disabled. if ex1 = 1, the external interrupt 1 is enabled. et0 timer 0 overflow interrupt enable. if et0 = 0, the timer 0 interrupt is disabled. if et0 = 1, the timer 0 interrupt is enabled. ex0 external interrupt 0 enable. if ex0 = 0, the external interrupt 0 is disabled. if ex0 = 1, the external interrupt 0 is disabled. eal wdt et2 es a8 h ien0 bit no. af h msb lsb et1 ex1 et0 ex0 ae h ad h ac h ab h aa h a9 h a8 h
semiconductor group 7-5 interrupt system c515 the ien1 register contains enable/disable flags of the timer 2 external timer reload interrupt, the external interrupts 2 to 6, and the a/d converter interrupt. special function register ien1 (address b8 h ) reset value : 00 h the shaded bit is not used for interrupt control. bit function exen2 timer 2 external reload interrupt enable if exen2 = 0, the timer 2 external reload interrupt is disabled. if exen2 = 1, the timer 2 external reload interrupt is enabled. the external reload function is not affected by exen2. ex6 external interrupt 6 / capture/compare interrupt 3 enable if ex6 = 0, external interrupt 6 is disabled. if ex6 = 1, external interrupt 6 is enabled. ex5 external interrupt 5 / capture/compare interrupt 2 enable if ex5 = 0, external interrupt 5 is disabled. if ex5 = 1, external interrupt 5 is enabled. ex4 external interrupt 4 / capture/compare interrupt 1 enable if ex4 = 0, external interrupt 4 is disabled. if ex4 = 1, external interrupt 4 is enabled. ex3 external interrupt 3 / capture/compare interrupt 0 enable if ex3 = 0, external interrupt 3 is disabled. if ex3 = 1, external interrupt 3 is enabled. ex2 external interrupt 2 / capture/compare interrupt 4 enable if ex2 = 0, external interrupt 2 is disabled. if ex2 = 1, external interrupt 2 is enabled. eadc a/d converter interrupt enable if eadc = 0, the a/d converter interrupt is disabled. if eadc = 1, the a/d converter interrupt is enabled. exen2 swdt ex6 ex5 b8 h ien1 bit no. bf h msb lsb ex4 ex3 ex2 eadc be h bd h bc h bb h ba h b9 h b8 h
semiconductor group 7-6 interrupt system c515 7.1.2 interrupt request / control flags special function register tcon (address 88 h ) reset value : 00 h the shaded bits are not used for interrupt control. the external interrupts 0 and 1 (int0 and int1 ) can each be either level-activated or negative transition-activated, depending on bits it0 and it1 in register tcon. the flags that actually generate these interrupts are bits ie0 and le1 in tcon. when an external interrupt is generated, the flag that generated this interrupt is cleared by the hardware when the service routine is vectored too, but only if the interrupt was transition-activated. lf the interrupt was level-activated, then the requesting external source directly controls the request flag, rather than the on-chip hardware. the timer 0 and timer 1 interrupts are generated by tf0 and tf1 in register tcon, which are set by a rollover in their respective timer/counter registers. when a timer interrupt is generated, the flag that generated it is cleared by the on-chip hardware when the service routine is vectored too. bit function tf1 timer 1 overflow flag set by hardware on timer/counter 1 overflow. cleared by hardware when processor vectors to interrupt routine. tf0 timer 0 overflow flag set by hardware on timer/counter 0 overflow. cleared by hardware when processor vectors to interrupt routine. ie1 external interrupt 1 request flag set by hardware when external interrupt 1 edge is detected. cleared by hardware when processor vectors to interrupt routine. it1 external interrupt 1 level/edge trigger control flag if it1 = 0, low level triggered external interrupt 1 is selected. if it1 = 1, falling edge triggered external interrupt 1 is selected. ie0 external interrupt 0 request flag set by hardware when external interrupt 0 edge is detected. cleared by hardware when processor vectors to interrupt routine. it0 external interrupt 0 level/edge trigger control flag if it0 = 0, low level triggered external interrupt 0 is selected. if it0 = 1, falling edge triggered external interrupt 0 is selected. tf1 tr1 tf0 tr0 88 h tcon bit no. 8f h msb lsb ie1 it1 ie0 it0 8e h 8d h 8c h 8b h 8a h 89 h 88 h
semiconductor group 7-7 interrupt system c515 special function register t2con (address c8 h ) reset value : 00 h the shaded bits are not used for interrupt control. the external interrupt 2 (int2 ) can be either positive or negative transition-activated depending on bit i2fr in register t2con. the flag that actually generates this interrupt is bit iex2 in register ircon. lf an interrupt 2 is generated, flag iex2 is cleared by hardware when the service routine is vectored to. the external interrupt 3 (int3) can be either positive or negative transition-activated, depending on bit i3fr in register t2con. the flag that actually generates this interrupt is bit iex3 in register ircon. in addition, this flag will be set if a compare event occurs at pin p1.0/int3 /cc0, regardless of the compare mode established and the transition at the respective pin. the flag iex3 is cleared by hardware when the service routine is vectored to. bit function i3fr external interrupt 3 rising/falling edge control flag if i3fr = 0, the external interrupt 3 is activated by a falling edge at p1.0/int3 /cc0. if i3fr = 1, the external interrupt 3 is activated by a rising edge at p1.0/int3 /cc0. i2fr external interrupt 2 rising/falling edge control flag if i2fr = 0, the external interrupt 2 is activated by a falling edge at p1.4/int2 . if i2fr = 1, the external interrupt 2 is activated by a rising edge at p1.4/int2 . t2ps i3fr i2fr t2r1 c8 h t2con bit no. cf h msb lsb t2r0 t2cm t2i1 t2i0 ce h cd h cc h cb h ca h c9 h c8 h
semiconductor group 7-8 interrupt system c515 special function register ircon (address c0 h ) reset value : 00 h bit function exf2 timer 2 external reload flag exf2 is set when a reload is caused by a falling edge on pin t2ex while exen2 = 1. if et2 in ien0 is set (timer 2 interrupt enabled), exf2 = 1 will cause an interrupt. exf2 can be used as an additional external interrupt when the reload function is not used. exf2 must be cleared by software. tf2 timer 2 overflow flag set by a timer 2 overflow and must be cleared by software. if the timer 2 interrupt is enabled, tf2 = 1 will cause an interrupt. iex6 external interrupt 6 edge flag set by hardware when external interrupt edge was detected or when a compare event occurred at pin p1.3/int6/cc3. cleared by hardware when processor vectors to interrupt routine. iex5 external interrupt 5 edge flag set by hardware when external interrupt edge was detected or when a compare event occurred at pin p1.2/int5/cc2. cleared by hardware when processor vectors to interrupt routine. iex4 external interrupt 4 edge flag set by hardware when external interrupt edge was detected or when a compare event occurred at pin p1.1/int4/cc1. cleared by hardware when processor vectors to interrupt routine. iex3 external interrupt 3 edge flag set by hardware when external interrupt edge was detected or when a compare event occurred at pin p1.0/int3 /cc0. cleared by hardware when processor vectors to interrupt routine. iex2 external interrupt 2 edge flag set by hardware when external interrupt edge was detected at pin p1.4/int2 . cleared by hardware when processor vectors to interrupt routine. iadc a/d converter interrupt request flag set by hardware at the end of an a/d conversion. must be cleared by software. exf2 tf2 iex6 iex5 c0 h ircon bit no. c7 h msb lsb iex4 iex3 iex2 iadc c6 h c5 h c4 h c3 h c2 h c1 h c0 h
semiconductor group 7-9 interrupt system c515 the timer 2 interrupt is generated by the logical or of bit tf2 in register t2con and bit exf2 in register ircon. neither of these flags is cleared by hardware when the service routine is vectored to. in fact, the service routine may have to determine whether it was tf2 or exf2 that generated the interrupt, and the bit will have to be cleared by software. the a/d converter interrupt is generated by iadc bit in register ircon. if an interrupt is generated, in any case the converted result in addat is valid on the first instruction of the interrupt service routine. lf continuous conversion is established, iadc is set once during each conversion. lf an a/d converter interrupt is generated, flag iadc will have to be cleared by software. the external interrupts 4 to 6 (int4, int5, int6) are positive transition-activated. the flags that actually generate these interrupts are bits iex4, iex5, and iex6 in register ircon. in addition, these flags will be set if a compare event occurs at the corresponding output pin p1.1/ int4/cc1, p1.2/int5/cc2, and p1.3/int6/cc3, regardless of the compare mode established and the transition at the respective pin. when an interrupt is generated, the flag that generated it is cleared by the on-chip hardware when the service routine is vectored too. all of these interrupt request bits that generate interrupts can be set or cleared by software, with the same result as if they had been set or cleared by hardware. that is, interrupts can be generated or pending interrupts can be cancelled by software. the only exceptions are the request flags ie0 and le1. lf the external interrupts 0 and 1 are programmed to be level-activated, ie0 and le1 are controlled by the external source via pin int0 and int1 , respectively. thus, writing a one to these bits will not set the request flag ie0 and/or le1. in this mode, interrupts 0 and 1 can only be generated by software and by writing a 0 to the corresponding pins int0 (p3.2) and int1 (p3.3), provided that this will not affect any peripheral circuit connected to the pins.
semiconductor group 7-10 interrupt system c515 special function register scon (address. 98 h ) reset value : 00 h the shaded bits are not used for interrupt control. the serial port interrupt is generated by a logical or of flag ri and ti in sfr scon. neither of these flags is cleared by hardware when the service routine is vectored too. in fact, the service routine will normally have to determine whether it was the receive interrupt flag or the transmission interrupt flag that generated the interrupt, and the bit will have to be cleared by software. bit function ti serial interface transmitter interrupt flag set by hardware at the end of a serial data transmission. must be cleared by software. ri serial interface receiver interrupt flag set by hardware if a serial data byte has been received. must be cleared by software. sm0 sm1 sm2 ren 98 h scon bit no. 9f h msb lsb tb8 rb8 ti ri 9e h 9d h 9c h 9b h 9a h 99 h 98 h
semiconductor group 7-11 interrupt system c515 7.1.3 interrupt priority registers the lower six bits of these two registers are used to define the interrupt priority level of the interrupt groups as they are defined in table 7-1 in the next section. special function register ip0 (address a9 h ) reset value : x0000000 b special function register ip1 (address b9 h ) reset value : xx000000 b the shaded bits are not used for interrupt control. bit function ip1.x ip0.x interrupt group priority level bits (x=1-6, see table 7-1 ) C wdts ip0.5 ip0.4 a9 h ip0 ip0.3 ip0.2 ip0.1 ip0.0 bit no. 76543210 msb lsb C C ip1.5 ip1.4 b9 h ip1 ip1.3 ip1.2 ip1.1 ip1.0 bit no. 76543210 ip1.x ip0.x function 0 0 interrupt group x is set to priority level 0 (lowest) 0 1 interrupt group x is set to priority level 1 1 0 interrupt group x is set to priority level 2 1 1 interrupt group x is set to priority level 3 (highest)
semiconductor group 7-12 interrupt system c515 7.2 interrupt priority level structure the following table shows the interrupt grouping of the c515 interrupt sources. each pair of interrupt sources can be programmed individually to one of four priority levels by setting or clearing one bit in the special function register ip0 and one in ip1. a low-priority interrupt can be interrupted by a high-priority interrupt, but not by another interrupt of the same or a lower priority. an interrupt of the highest priority level cannot be interrupted by another interrupt source. lf two or more requests of different priority leveis are received simultaneously, the request of the highest priority is serviced first. lf requests of the same priority level are received simultaneously, an internal polling sequence determines which request is to be serviced first. thus, within each priority level there is a second priority structure determined by the polling sequence, as follows. C within one interrupt group the ?left interrupt is serviced first C the interrupt groups are serviced from top to bottom of the table. table 7-1 interrupt source structure interrupt group associated interrupts priority 1 external interrupt 0 a/d converter interrupt high low 2 timer 0 overflow external interrupt 2 3 external interrupt 1 external interrupt 3 4 timer 1 overflow external interrupt 4 5 serial channel interrupt external interrupt 5 6 timer 2 interrupt external interrupt 6 high priority low priority
semiconductor group 7-13 interrupt system c515 7.3 how interrupts are handled the interrupt flags are sampled at s5p2 in each machine cycle. the sampled flags are polled during the following machine cycle. if one of the flags was in a set condition at s5p2 of the preceeding cycle, the polling cycle will find it and the interrupt system will generate a lcall to the appropriate service routine, provided this hardware-generated lcall is not blocked by any of the following conditions: 1. an interrupt of equal or higher priority is already in progress. 2. the current (polling) cycle is not in the final cycle of the instruction in progress. 3. the instruction in progress is reti or any write access to registers ien0 and ien1 or ip0/ip1. any of these three conditions will block the generation of the lcall to the interrupt service routine. condition 2 ensures that the instruction in progress is completed before vectoring to any service routine. condition 3 ensures that if the instruction in progress is reti or any write access to registers ien0/ien1 or ip0/ip1, then at least one more instruction will be executed before any interrupt is vectored too; this delay guarantees that changes of the interrupt status can be observed by the cpu. the polling cycle is repeated with each machine cycle, and the values polled are the values that were present at s5p2 of the previous machine cycle. note that if any interrupt flag is active but not being responded to for one of the conditions already mentioned, or if the flag is no longer active when the blocking condition is removed, the denied interrupt will not be serviced. in other words, the fact that the interrupt flag was once active but not serviced is not remembered. every polling cycle interrogates only the pending interrupt requests. the polling cycle/lcall sequence is illustrated in figure 7-3 . figure 7-3 interrupt response timing diagram mct01859 s5p2 interrupt is latched interrupts are polled vector address long call to interrupt routine interrupt c2 c1 c3 c4 c5
semiconductor group 7-14 interrupt system c515 note that if an interrupt of a higher priority level goes active prior to s5p2 in the machine cycle labeled c3 in figure 7-3 then, in accordance with the above rules, it will be vectored to during c5 and c6 without any instruction for the lower priority routine to be executed. thus, the processor acknowledges an interrupt request by executing a hardware-generated lcall to the appropriate servicing routine. in some cases it also clears the flag that generated the interrupt, while in other cases it does not; then this has to be done by the user's software. the hardware clears the external interrupt flags ie0 and ie1 only if they were transition-activated. the hardware-generated lcall pushes the contents of the program counter onto the stack (but it does not save the psw) and reloads the program counter with an address that depends on the source of the interrupt being vectored too, as shown in the following table 7-2 . execution proceeds from that location until the reti instruction is encountered. the reti instruction informs the processor that the interrupt routine is no longer in progress, then pops the two top bytes from the stack and reloads the program counter. execution of the interrupted program continues from the point where it was stopped. note that the reti instruction is very important because it informs the processor that the program left the current interrupt priority level. a simple ret instruction would also have returned execution to the interrupted program, but it would have left the interrupt control system thinking an interrupt was still in progress. in this case no interrupt of the same or lower priority level would be acknowledged. table 7-2 interrupt source and vectors interrupt source interrupt vector address interrupt request flags external interrupt 0 0003 h ie0 timer 0 overflow 000b h tf0 external interrupt 1 0013 h ie1 timer 1 overflow 001b h tf1 serial channel 0023 h ri / ti timer 2 overflow / ext. reload 002b h tf2 / exf2 a/d converter 0043 h iadc external interrupt 2 004b h iex2 external interrupt 3 0053 h iex3 external interrupt 4 005b h iex4 external interrupt 5 0063 h iex5 external interrupt 6 006b h iex6
semiconductor group 7-15 interrupt system c515 7.4 external interrupts the external interrupts 0 and 1 can be programmed to be level-activated or negative-transition activated by setting or clearing bit it0, respectively in register tcon. if itx = 0 (x = 0 or 1), external interrupt x is triggered by a detected low level at the intx pin. if itx = 1, external interrupt x is negative edge-triggered. in this mode, if successive samples of the intx pin show a high in one cycle and a low in the next cycle, interrupt request flag iex in tcon is set. flag bit iex=1 then requests the interrupt. if the external interrupt 0 or 1 is level-activated, the external source has to hold the request active until the requested interrupt is actually generated. then it has to deactivate the request before the interrupt service routine is completed, or else another interrupt will be generated. the external interrupts 2 and 3 can be programmed to be negative or positive transition-activated by setting or clearing bit i2fr or i3fr in register t2con. lf ixfr = 0 (x = 2 or 3), the external interrupt x is negative transition-activated. lf ixfr = 1, the external interrupt is triggered by a positive transition. the external interrupts 4, 5, and 6 are activated only by a positive transition. the external timer 2 reload trigger interrupt request flag exf2 will be activated by a negative transition at pin pl.5/t2ex but only if bit exen2 is set. since the external interrupt pins (int2 to int6) are sampled once in each machine cycle, an input high or low should be held for at least 6 oscillator periods to ensure sampling. lf the external interrupt is transition-activated, the external source has to hold the request pin low (high for int2 and int3 , if it is programmed to be negative transition-active) for at least one cycle, and then hold it high (low) for at least one cycle to ensure that the transition is recognized so that the corresponding interrupt request flag will be set (see figure 7-4 ). the external interrupt request flags will automatically be cleared by the cpu when the service routine is called.
semiconductor group 7-16 interrupt system c515 figure 7-4 external interrupt detection mcd01860 p3.x/intx e.g. p3.x/intx > 1 machine cycle low-level threshold > 1 machine cycle > 1 machine cycle transition to be detected high-level threshold low-level threshold b) transition-activated interrupt a) level-activated interrupt
semiconductor group 7-17 interrupt system c515 7.5 interrupt response time if an external interrupt is recognized, its corresponding request flag is set at s5p2 in every machine cycle. the value is not polled by the circuitry until the next machine cycle. if the request is active and conditions are right for it to be acknowledged, a hardware subroutine call to the requested service routine will be next instruction to be executed. the call itself takes two cycles. thus a minimum of three complete machine cycles will elapse between activation and external interrupt request and the beginning of execution of the first instruction of the service routine. a longer response time would be obtained if the request was blocked by one of the three previously listed conditions. if an interrupt of equal or higer priority is already in progress, the additional wait time obviously depends on the nature of the other interrupt's service routine. if the instruction in progress is not in its final cycle, the additional wait time cannot be more than 3 cycles since the longest instructions (mul and div) are only 4 cycles long; and, if the instruction in progress is reti or a write access to registers ien0, ien1 or ip0, ip1 the additional wait time cannot be more than 5 cycles (a maximum of one more cycle to complete the instruction in progress, plus 4 cycles to complete the next instruction, if the instruction is mul or div). thus a single interrupt system, the response time is always more than 3 cycles and less than 9 cycles.
semiconductor group 8-1 fail safe mechanisms c515 8 fail safe mechanisms 8.1 watchdog timer 8.1.1 general operation as a means of graceful recovery from software or hardware upset a watchdog timer is provided in the c515. lf the software fails to clear the watchdog timer at least every 65532 m s (at 12 mhz clock rate), an internal hardware reset will be initiated. the software can be designed such that the watchdog times out if the program does not progress properly. the watchdog will also time out if the software error was due to hardware-related problems. this prevents the controller from malfunctioning for longer than 65 ms if a 12-mhz oscillator is used. the watchdog timer is a 16-bit counter which is incremented once every machine cycle. after an external reset the watchdog timer is disabled and cleared to 0000 h . 8.1.2 starting the watchdog timer there are two ways to start the watchdog timer depending on the level applied to pin pe /swd. this pin serves two functions, because it is also used for blocking the power saving modes. (see also chapter 9 ). 8.1.2.1 the first possibility of starting the watchdog timer the automatic start of the watchdog timer directly during an external hw reset is achieved by strapping pin pe /swd to v cc . in this case the power saving modes (power down mode, idle mode and slow down mode) are also disabled and cannot be started by software. if pin pe /swd is left unconnected, a weak pull-up transistor ensures the automatic start of the watchdog timer. the self-start of the watchdog timer by a pin option has been implemented to provide high system security in electrically very noisy environments. note: the automatic start of the watchdog timer is only performed if pe /swd (power-save enable /start watchdog timer) is held at high level while reset is active. a positive transition at pe /swd pin during normal program execution will not start the watchdog timer. 8.1.2.2 the second possibility of starting the watchdog timer the watchdog timer can also be started by software. setting of bit swdt in sfr ien1 starts the watchdog timer. after having been started, the bit wdts in sfr ip0 is set. note that the watchdog timer cannot be stopped by software. see chapter 9 for entering the power saving modes by software.
semiconductor group 8-2 fail safe mechanisms c515 8.1.3 refreshing the watchdog timer once started, the watchdog timer can only be cleared to 0000 h by first setting bit wdt and with the next instruction setting bit swdt. bit wdt will automatically be cleared during the second machine cycle after having been set. for this reason, setting swdt bit has to be a one cycle instruction (e.g. setb swdt). this double instruction clearing of the watchdog timer was implemented to minimize the chance of unintentionally clearing the watchdog. to prevent the watchdog from overflowing, it must be cleared periodically. setting only bit swdt does not reload the watchdog timer automatically to 0000 h . a watchdog timer reset operation occurs only by using the double instruction refresh sequence setb wdt / setb swdt. 8.1.4 watchdog reset and watchdog status flag lf the software fails to clear the watchdog in time, an internally generated watchdog reset is entered at the counter state fffc h and lasts four instruction cycles. this internal reset differs from an external reset only to the extent that the watchdog timer is not disabled. bit wdts allows the software to examine from which source the reset was initiated. lf it is set, the reset was caused by a watchdog timer overflow. figure 8-1 shows a block diagram of the watchdog timer. figure 8-1 block diagram of the watchdog timer mcb03210 control logic wdt reset if wdt count is between ien1 ien0 ) (b8 h h a8 () 16-bit watchdog timer ip0 ( a9 h ) wdt swdt - - - - - - - - - - - - - - external hw reset -- - - - - - wdts osc f 12 reset fffc hh ffff - pe/swd
semiconductor group 8-3 fail safe mechanisms c515 8.1.5 wdt control and status flags the watchdog timer is controlled by two control flags (located in sfr ien0 and ien1) and one status flags (located in sfr ip0). special function register ien0 (address a8 h ) reset value : 00 h special function register ien1 (address b8 h ) reset value : 00 h special function register ip0 (address a9 h ) reset value : x0000000 b the shaded bits are not used for fail save control. bit function wdt watchdog timer refresh flag. set to initiate a refresh of the watchdog timer. must be set directly before swdt is set to prevent an unintentional refresh of the watchdog timer. wdt is reset by hardware two processor cycles after it has been set. swdt watchdog timer start/refresh flag. set to activate the watchdog timer. when directly set after setting wdt, a watchdog timer refresh/reset is performed. bit sdwt is reset by hardware two processor cycles after it has been set. wdts watchdog timer status flag. set by hardware when a watchdog timer reset occured. can be cleared and set by software. eal wdt et2 es a8 h ien0 af h msb lsb et1 ex1 et0 ex0 ae h ad h ac h ab h aa h a9 h a8 h exen2 swdt ex6 ex5 b8 h ien1 bf h ex4 ex3 ex2 eadc be h bd h bc h bb h ba h b9 h b8 h C wdts ip0.5 ip0.4 a9 h ip0 ip0.3 ip0.2 ip0.1 ip0.0 bit no. 76543210
semiconductor group 9-1 power saving modes c515 9 power saving modes the c515 provides two basic power saving modes, the idle mode and the power down mode. additionally, a slow down mode is available. this power saving mode reduces the internal clock rate in normal operating mode and it can be also used for further power reduction in idle mode. all the power saving modes are initiated by software. 9.1 hardware enable for the use of the power saving modes to provide power saving modes together with effective protection against unintentional entering of these modes, the c515 has an extra pin disabling the use of the power saving modes. as this pin will most likely be used only in critical applications it is combined with an automatic start of the watchdog timer (see the description in chapter 8 fail save mechanisms). this pin is called pe / swd (power saving enable/start watchdog timer) and its function is as follows: pe /swd = 1 (logic high level) C use of the power saving modes is not possible. the instruction sequences used for entering these modes will not affect the normal operation of the device. C lf and only if pe /swd is held at high level during reset, the watchdog timer is started immediately after reset is released. pe /swd = 0 (logic low level) C all power saving modes can be activated as described in the following sections C the watchdog timer has to be started by software if system protection is desired. when left unconnected, the pin pe /swd is pulled to high level by a weak internal pullup. this is done to provide system protection by default. the logic level applied to pin pe /swd can be changed during program execution in order to allow or block the use of the power saving modes without any effect on the on-chip watchdog circuitry; (the watchdog timer is started only if pe /swd is on high level up to the moment when reset is released; a change at pe /swd during program execution has no effect on the watchdog timer; this only enables or disables the use of the power saving modes.). a change of the pins level is detected in state 3, phase 1. a schmitt trigger is used at the input to reduce susceptibility to noise. in addition to the hardware enable/disable of the power saving modes, a double-instruction sequence which is described in the corresponding sections is necessary to enter power down and idle mode. the combination of all these safety precautions provide a maximum of system protection. application example for switching pin pe /swd for most applications in noisy environments, components external to the chip are used to give warning of a power failure or a turn off of the power supply. these circuits could be used to control the pe /swd pin. the possible steps to go into power down mode could then be as follows: C a power-fail signal forces the controller to go into a high priority interrupt routine. this interrupt routine saves the actual program status. at the same time pin pe /swd is pulled low by the power-fail signal. C finally the controller enters power down mode by executing the relevant double-instruction sequence.
semiconductor group 9-2 power saving modes c515 9.2 power saving mode control register the functions of the power saving modes are controlled by bits which are located in the special function register pcon. the bits pde, pds and idle, idls located in sfr pcon select the power down mode or the idle mode, respectively. if the power down mode and the idle mode are set at the same time, power down takes precedence. furthermore, register pcon contains two general purpose flags. for example, the flag bits gf0 and gf1 can be used to give an indication if an interrupt occurred during normal operation or during an idle. for this, an instruction that activates idle can also set one or both flag bits. when idle is terminated by an interrupt, the interrupt service routine can examine the flag bits. special function register pcon (address 87 h) reset value : 00 h note: the pds bit, which controls the software power down mode is forced to logic low whenever the external pe /swd pin is held at logic high level. changing the logic level of the pe /swd pin from high to low will irregularly terminate the software power down mode and is not permitted. symbol function pds power down start bit the instruction that sets the pds flag bit is the last instruction before entering the power down mode idls idle start bit the instruction that sets the idls flag bit is the last instruction before entering the idle mode. sd slow down mode bit when set, the slow down mode is enabled. this function is available in the c515-lm/1rm versions only. gf1 general purpose flag gf0 general purpose flag pde power down enable bit when set, starting of the power down is enabled idle idle mode enable bit when set, starting of the idle mode is enabled msb lsb 87 h pcon smod pds idls sd gf1 gf0 pde idle 76543210 bit no. the function of the shaded bit is not described in this section.
semiconductor group 9-3 power saving modes c515 9.3 idle mode in the idle mode the oscillator of the c515 continues to run, but the cpu is gated off from the clock signal. however, the interrupt system, the serial port, the a/d converter, and all timers with the exception of the watchdog timer are further provided with the clock. the cpu status is preserved in its entirety: the stack pointer, program counter, program status word, accumulator, and all other registers maintain their data during idle mode. the reduction of power consumption, which can be achieved by this feature depends on the number of peripherals running. if all timers are stopped and the a/d converter, and the serial interfaces are not running, the maximum power reduction can be achieved. this state is also the test condition for the idle mode i cc . thus, the user has to take care which peripheral should continue to run and which has to be stopped during idle mode. also the state of all port pins C either the pins controlled by their latches or controlled by their secondary functions C depends on the status of the controller when entering idle mode. normally, the port pins hold the logical state they had at the time when the idle mode was activated. if some pins are programmed to serve as alternate functions they still continue to output during idle mode if the assigned function is on. this especially applies to the serial interface in case it cannot finish reception or transmission during normal operation. the control signals ale and psen are held at logic high levels. as in normal operation mode, the ports can be used as inputs during idle mode. thus a capture or reload operation can be triggered, the timers can be used to count external events, and external interrupts will be detected. the idle mode is a useful feature which makes it possible to "freeze" the processor's status - either for a predefined time, or until an external event reverts the controller to normal operation, as discussed below. the watchdog timer is the only peripheral which is automatically stopped during idle mode.
semiconductor group 9-4 power saving modes c515 the idle mode is entered by two consecutive instructions. the first instruction sets the flag bit idle (pcon.0) and must not set bit idls (pcon.5), the following instruction sets the start bit idls (pcon.5) and must not set bit idle (pcon.0). the hardware ensures that a concurrent setting of both bits, idle and idls, does not initiate the idle mode. bits idle and idls will automatically be cleared after being set. if one of these register bits is read the value that appears is 0. this double instruction is implemented to minimize the chance of an unintentional entering of the idle mode which would leave the watchdog timer's task of system protection without effect. note: pcon is not a bit-addressable register, so the above mentioned sequence for entering the idle mode is obtained by byte-handling instructions, as shown in the following example: orl pcon,#00000001b ;set bit idle, bit idls must not be set orl pcon,#00100000b ;set bit idls, bit idle must not be set the instruction that sets bit idls is the last instruction executed before going into idle mode. there are two ways to terminate the idle mode: C the idle mode can be terminated by activating any enabled interrupt. the cpu operation is resumed, the interrupt will be serviced and the next intsruction to be executed after the reti instruction will be the one following the instruction that had set the bit idls. C the other way to terminate the idle mode, is a hardware reset. since the oscillator is still running, the hardware reset must be held active only for two machine cycles for a complete reset.
semiconductor group 9-5 power saving modes c515 9.4 slow down mode operation (c515-lm/1rm only) in some applications, where power consumption and dissipation are critical, the controller might run for a certain time at reduced speed (e.g. if the controller is waiting for an input signal). since in cmos devices there is an almost linear dependence of the operating frequency and the power supply current, a reduction of the operating frequency results in reduced power consumption. in the slow down mode all signal frequencies that are derived from the oscillator clock are divided by 8. the slow down mode is activated by setting the bit sd in sfr pcon. if the slow down mode is enabled, the clock signals for the cpu and the peripheral units are reduced to 1/8 of the nominal system clock rate. the controller actually enters the slow down mode after a short synchronization period (max. two machine cycles). the slow down mode is terminated by clearing bit sd. the slow down mode can be combined with the idle mode by performing the following double instruction sequence: orl pcon,#00000001b ; preparing idle mode: set bit idle (idls not set) orl pcon,#00110000b ; entering idle mode combined with the slow down mode: ; (idls and sd set) there are two ways to terminate the combined idle and slow down mode : C the idle mode can be terminated by activation of any enabled interrupt. the cpu operation is resumed, the interrupt will be serviced and the next instruction to be executed after the reti instruction will be the one following the instruction that had set the bits idls and sd. nevertheless the slow down mode keeps enabled and if required has to be terminated by clearing the bit sd in the corresponding interrupt service routine or at any point in the program where the user no longer requires the slow-down mode power saving. C the other possibility of terminating the combined idle and slow down mode is a hardware reset. since the oscillator is still running, the hardware reset has to be held active for only two machine cycles for a complete reset. the slow down feature is not available for c515-ln/1rn versions.
semiconductor group 9-6 power saving modes c515 9.5 power down mode in the power down mode, the rc osciillator and the on-chip oscillator which operates with the xtal pins is stopped. therefore, all functions of the microcontroller are stopped and only the contents of the on-chip ram and the sfr's are maintained. the port pins, which are controlled by their port latches, output the values that are held by their sfr's. the port pins which serve the alternate output functions show the values they had at the end of the last cycle of the instruction which initiated the power down mode. ale and psen held at logic low level (see table 9-1 ). in the power down mode of operation, v cc can be reduced to minimize power consumption. it must be ensured, however, that is v cc not reduced before the power down mode is invoked, and that v cc is restored to its normal operating level before the power down mode is terminated. the power down mode can be left only by a hardware reset. leaving the power down mode puts the microcontroller with its sfrs into the reset state, and it should not be done before v cc is restored to its nominal operating level. 9.5.1 invoking power down mode the power down mode is entered by two consecutive instructions. the first instruction has to set the flag bit pde (pcon.1) and must not set bit pds (pcon.6), the following instruction has to set the start bit pds (pcon.6) and must not set bit pde (pcon.1). the hardware ensures that a concurrent setting of both bits, pde and pds, does not initiate the power down mode. bits pde and pds will automatically be cleared after having been set and the value shown by reading one of these bits is always 0. this double instruction is implemented to minimize the chance of unintentionally entering the power down mode which could possibly freeze the chip's activity in an undesired status. pcon is not a bit-addressable register, so the above mentioned sequence for entering the power down mode is obtained by byte-handling instructions, as shown in the following example: orl pcon,#00000010b ;set bit pde, bit pds must not be set orl pcon,#01000000b ;set bit pds, bit pde must not be set, enter power down the instruction that sets bit pds is the last instruction executed before going into power down mode. when the double instruction sequence shown above is used, the power down mode can only be left by a reset operation. note : before entering the power down mode, an a/d conversion in progress must be stopped. 9.5.2 exit from power down mode if power down mode is exit via a hardware reset, the microcontroller with its sfrs is put into the hardware reset state and the content of ram is not changed. the reset signal that terminates the power down mode also restarts the rc oscillator and the on-chip oscillatror. the reset operation should not be activated before v cc is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize (similar to power-on reset).
semiconductor group 9-7 power saving modes c515 9.6 state of pins in the power saving modes in the idle mode and in the power down mode the port pins of the c515 have a well defined status which is listed in the following table 9-1 . this state of some pins also depends on the location of the code memory (internal or external). table 9-1 status of external pins during idle and software power down mode outputs last instruction executed from internal code memory last instruction executed from external code memory idle power down idle power down ale high low high low psen high low high low port 0 data data float float port 2 data data address data port 1, 3, 4 data / alternate outputs data / last output data / alternate outputs data / last output
semiconductor group 10-1 device specifications c515 10 device specifications 10.1 absolute maximum ratings ambient temperature under bias ( t a ) .............................................................. 0 ?c to + 110 ?c storage temperature ( t st ) ...............................................................................C 65 ?c to + 150 ?c voltage on v cc pins with respect to ground ( v ss ) ............................................C 0.5 v to 6.5 v voltage on any pin with respect to ground ( v ss ) ..............................................C 0.5 v to v cc + 0.5 v input current on any pin during overload condition..........................................C 10 ma to + 10 ma absolute sum of all input currents during overload condition ..........................| 100 ma | power dissipation.............................................................................................tbd note: stresses above those listed under absolute maximum ratings may cause permanent damage of the device. this is a stress rating only and functional operation of the device at these or any other conditions above those indicated in the operational sections of this specification is not implied. exposure to absolute maximum rating conditions for longer periods may affect device reliability. during overload conditions ( v in > v cc or v in < v ss ) the voltage on v cc pins with respect to ground ( v ss ) must not exceed the values defined by the absolute maximum ratings.
semiconductor group 10-2 device specifications c515 10.2 dc characteristics v cc = 5 v + 10%, C 15%; v ss = 0 v t a = 0 to 70 c for the sab-c515 t a = C 40 to 85 c for the saf-c515 t a = C 40 to 110 c for the sah-c515 notes see next page parameter symbol limit values unit test condition min. max. input low voltages all except ea ea pin v il v il1 C 0.5 C 0.5 0.2 v cc - 0.1 0.2 v cc - 0.3 v v C C input high voltages all except xtal2 and reset xtal2 pin reset pin v ih v ih1 v ih2 0.2 v cc + 0.9 0.7 v cc 0.6 v cc v cc + 0.5 v cc + 0.5 v cc + 0.5 v v v C C C output low voltages ports 1, 2, 3, 4, 5 port 0, ale, psen v ol v ol1 C C 0.45 0.45 v v i ol = 1.6 ma 1) i ol = 3.2 ma 1) output high voltages ports 1, 2, 3, 4, 5 port 0 an 2 in external bus mode, ale, psen v oh v oh2 2.4 0.9 v cc 2.4 0.9 v cc C C C C v v v v i oh = C 80 m a i oh = C 10 m a ) i oh = C 800 m a 2) i oh = C 80 m a 2) logic 0 input current ports 1, 2, 3, 4, 5 i il C 10 C 70 m a v in = 0.45 v logical 0-to-1 transition current ports 1, 2, 3, 4, 5 i tl C 65 C 650 m a v in = 2 v input leakage current port 0, ain0-7 (port 6), ea i li C 1 m a 0.45 < v in < v cc input low current to reset for reset xtal2 pe i li2 i li3 i li4 C10 C C C 100 C 15 C 20 m a m a m a v in = 0.45 v v in = 0.45 v v in = 0.45 v pin capacitance c io C10pf f c = 1 mhz, t a = 25 c overload current i ov C 5ma 7) 8)
semiconductor group 10-3 device specifications c515 power supply current 1) capacitive loading on ports 0 and 2 may cause spurious noise pulses to be superimposed on the v ol of ale and ports1, 3, 4, and 5. the noise is due to external bus capacitance discharging into the port 0 and port 2 pins when these pins make 1-to-0 transitions during bus operation. in the worst case (capacitive loading > 100 pf), the noise pulse on ale line may exceed 0.8 v. in such cases it may be desirable to qualify ale with a schmitt- trigger, or use an address latch with a schmitt-trigger strobe input. 2) capacitive loading on ports 0 and 2 may cause the v oh on ale and psen to momentarily fall below the 0.9 v cc specification when the address lines are stabilizing. 3) i pd (power-down mode) is measured under following conditions: ea = port 0 = port 6 = v cc ; reset = v cc ; xtal1 = n.c.; pe = xtal2 = v ss ; v agnd = v ss ; v aref = v cc ; all other pins are disconnected. the typical i pd current is measured at v cc = 5v. 4) i cc (active mode) is measured with: xtal2 driven with t clch , t chcl = 5 ns , v il = v ss + 0.5 v, v ih = v cc C 0.5 v; xtal1 = n.c.; ea = port 0 = port 6 = v cc ; reset = v ss ; all other pins are disconnected. 5) i cc (idle mode) is measured with all output pins disconnected and with all peripherals disabled; xtal2 driven with t clch , t chcl = 5 ns, v il = v ss + 0.5 v, v ih = v cc C 0.5 v; xtal1 = n.c.; ea = port 0 = port 6 = v cc ; reset = v cc ; all other pins are disconnected; 6) i cc (active mode with slow-down mode) is measured with : xtal2 driven with t clch , t chcl = 5 ns , v il = v ss + 0.5 v, v ih = v cc C 0.5 v; xtal1 = n.c.; ea = port 0 = port 6 = v cc ; reset = v cc ; all other pins are disconnected; the microcontroller is put into slow-down mode by software; all peripheral units are not activated. 7) overload conditions occur if the standard operating conditions are exceeded, ie. the voltage on any pin exceeds the specified range (i.e. v ov > v cc + 0.5 v or v ov < v ss - 0.5 v). the supply voltage v cc and v ss must remain within the specified limits. the absolute sum of input currents on all port pins may not exceed 50 ma. 8) not 100% tested, guaranteed by design characterization 9) the typical i cc values are periodically measured at t a = +25 ?c and v cc = 5 v but not 100% tested. 10)the maximum i cc values are measured under worst case conditions ( t a = 0 ?c or -40 ?c and v cc = 5.5 v) parameter symbol limit values unit test condition typ. 9) max. 10) active mode 12 mhz 16 mhz 24 mhz i cc i cc i cc 11.0 13.7 19.1 14.8 18.2 25 ma ma ma 4) idle mode 12 mhz 16 mhz 24 mhz i cc i cc i cc 5.8 6.9 9.1 8.1 9.6 12.8 ma ma ma 5) active mode with slow-down enabled 12 mhz 16 mhz 24 mhz i cc i cc i cc 4.2 4.9 6.3 6.1 7.0 8.8 ma ma ma 6) power-down mode i pd 10 30 m a 3)
semiconductor group 10-4 device specifications c515 icc diagram mcd03282 0 0 f osc cc i 4 8 12 16 20 24 5 10 15 20 25 30 mhz ma active mode idle mode active mode with slow down = 0.68 x + 2.8 f osc cc typ i : = 0.85 x + 4.6 : cc max i osc f = 0.39 x + 3.4 = 0.28 x + 2.4 : : cc max cc typ i i osc osc f f = 0.18 x + 2.0 = 0.23 x + 3.3 : : cc max i cc typ i osc f osc f active mode idle mode active mode with slow-down is the oscillator frequency in mhz. values are given in ma. i cc osc f cc typ i i cc max active mode idle mode
semiconductor group 10-5 device specifications c515 10.3 a/d converter characteristics v cc = 5 v + 10%, C 15%; v ss = 0 v t a = 0 to 70 c for the sab-c515 t a = C 40 to 85 c for the saf-c515 t a = C 40 to 110 c for the sah-c515 v cc C 0.25 v v aref v cc + 0.1 v ; v ss C 0.1 v v agnd v ss + 0.2 v; v intaref - v intagnd 3 1 v; notes: 1) v ain may exeed v agnd or v aref up to the absolute maximum ratings. however, the conversion result in these cases will be 00 h or ff h , respectively. 2) during the sample time the input capacitance c ain can be charged/discharged by the external source. the internal resistance of the analog source must allow the capacitance to reach their final voltage level within t s . after the end of the sample time t s , changes of the analog input voltage have no effect on the conversion result. 3) this parameter includes the sample time t s and the conversion time t co . the values for the conversion clock t adc is always 4 x t in . 4) t ue is tested at v aref = 5.0 v, v agnd = 0 v, v cc = 4.9 v. it is guaranteed by design characterization for all other voltages within the defined voltage range. if an overload condition occurs on maximum 2 not selected analog input pins and the absolute sum of input overload currents on all analog input pins does not exceed 10 ma, an additional conversion error of 1/2 lsb is permissible. 5) during the conversion the adcs capacitance must be repeatedly charged or discharged. the internal resistance of the reference source must allow the capacitance to reach their final voltage level within the indicated time. the maximum internal resistance results from the programmed conversion timing. 6) not 100% tested, but guaranteed by design characterization. parameter symbol limit values unit test condition min. max. analog input voltage v ain v agnd - 0.2 v aref + 0.2 v 1) a/d converter input clock t in C 2 x t clcl ns sample time t s C 40 x t in ns 2) conversion cycle time t adcc C 72 x t in ns 3) total unadjusted error t ue C 1 lsb v intaref = v aref = v cc v intagnd = v agnd = v ss 4) internal resistance of reference voltage source r aref C4 x t in /500 - 1 k w t in in [ns] 5) 6) internal resistance of analog source r asrc C t s / 500 - 1 k w t s in [ns] 2) 6) adc input capacitance c ain C45 pf 6)
semiconductor group 10-6 device specifications c515 10.4 ac characteristics (16 mhz) v cc = 5 v + 10%, C 15%; v ss = 0 v t a = 0 to 70 c for the sab-c515 t a = C 40 to 85 c for the saf-c515 t a = C 40 to 110 c for the sah-c515 ( c l for port 0, ale and psen outputs = 100 pf; c l for all other outputs = 80 pf) program memory characteristics *) interfacing the c515 to devices with float times up to 55 ns is permissible. this limited bus contention will not cause any damage to port 0 drivers. clkout timing parameter symbol limit values unit 16 mhz clock variable clock 1/ t clcl = 1 mhz to 16 mhz min. max. min. max. ale pulse width t lhll 85 C 2 t clcl C 40 C ns address setup to ale t avll 33 C t clcl C 30 C ns address hold after ale t llax 28 C t clcl C 35 C ns ale low to valid instruction in t lliv C 150 C 4 t clcl C 100 ns ale to psen t llpl 38 C t clcl C 25 C ns psen pulse width t plph 153 C 3 t clcl C 35 C ns psen to valid instruction in t pliv C88C 3 t clcl C 100 ns input instruction hold after psen t pxix 0C0Cns input instruction float after psen t pxiz *) C43C t clcl C 20 ns address valid after psen t pxav *) 55 C t clcl C 8 C ns address to valid instruction in t aviv C 198 C 5 t clcl C 115 ns address float to psen t azpl 0C0Cns parameter symbol limit values unit 16 mhz clock variable clock 1/ t clcl = 3.5 mhz to 16 mhz min. max. min. max. ale to clkout t llsh 398 C 7 t clcl C 40 C ns clkout high time t shsl 85 C 2 t clcl C 40 C ns clkout low time t slsh 585 C 10 t clcl C 40 C ns clkout low to ale high t sllh 23 103 t clcl C 40 t clcl + 40 ns
semiconductor group 10-7 device specifications c515 ac characteristics (16 mhz) (contd) external data memory characteristics external clock drive characteristics parameter symbol limit values unit 16 mhz clock variable clock 1/ t clcl = 1 mhz to 16 mhz min. max. min. max. rd pulse width t rlrh 275 C 6 t clcl C 100 C ns wr pulse width t wlwh 275 C 6 t clcl C 100 C ns address hold after ale t llax2 90 C 2t clcl C 35 C ns rd to valid data in t rldv C 148 C 5 t clcl C 165 ns data hold after rd t rhdx 0C0Cns data float after rd t rhdz C55C 2 t clcl C 70 ns ale to valid data in t lldv C 350 C 8 t clcl C 150 ns address to valid data in t avdv C 398 C 9 t clcl C 165 ns ale to wr or rd t llwl 138 238 3 t clcl C 50 3 t clcl + 50 ns address valid to wr or rd t avwl 120 C 4 t clcl C 130 C ns wr or rd high to ale high t whlh 23 103 t clcl C 40 t clcl + 40 ns data valid to wr transition t qvwx 13 C t clcl C 50 C ns data setup before wr t qvwh 288 C 7 t clcl C 150 C ns data hold after wr t whqx 13 C t clcl C 50 C ns address float after rd t rlaz C0C0ns parameter symbol limit values unit variable clock freq. = 1 mhz to 16 mhz min. max. oscillator period t clcl 62.5 1000 ns high time t chcx 20 t clcl C t clcx ns low time t clcx 20 t clcl C t chcx ns rise time t clch C20ns fall time t chcl C20ns
semiconductor group 10-8 device specifications c515 10.5 ac characteristics (24 mhz) v cc = 5 v + 10%, C 15%; v ss = 0 v t a = 0 to 70 c for the sab-c515 t a = C 40 to 85 c for the saf-c515 t a = C 40 to 110 c for the sah-c515 ( c l for port 0, ale and psen outputs = 100 pf; c l for all other outputs = 80 pf) program memory characteristics *) interfacing the c501 to devices with float times up to 37 ns is permissible. this limited bus contention will not cause any damage to port 0 drivers. clkout timing parameter symbol limit values unit 24 mhz clock variable clock 1/ t clcl = 1 mhz to 24 mhz min. max. min. max. ale pulse width t lhll 43 C 2 t clcl C 40 C ns address setup to ale t avll 17 C t clcl C 25 C ns address hold after ale t llax 17 C t clcl C 25 C ns ale low to valid instruction in t lliv C80C 4 t clcl C 87 ns ale to psen t llpl 22 C t clcl C 20 C ns psen pulse width t plph 95 C 3 t clcl C 30 C ns psen to valid instruction in t pliv C60C 3 t clcl C 65 ns input instruction hold after psen t pxix 0C0Cns input instruction float after psen t pxiz *) C32C t clcl C 10 ns address valid after psen t pxav *) 37 C t clcl C 5 C ns address to valid instruction in t aviv C 148 C 5 t clcl C 60 ns address float to psen t azpl 0C0Cns parameter symbol limit values unit 24 mhz clock variable clock 1/ t clcl = 3.5 mhz to 24 mhz min. max. min. max. ale to clkout t llsh 252 C 7 t clcl C 40 C ns clkout high time t shsl 43 C 2 t clcl C 40 C ns clkout low time t slsh 377 C 10 t clcl C 40 C ns clkout low to ale high t sllh 282 t clcl C 40 t clcl + 40 ns
semiconductor group 10-9 device specifications c515 ac characteristics (24 mhz) (contd) external data memory characteristics external clock drive characteristics parameter symbol limit values unit 24 mhz clock variable clock 1/ t clcl = 1 mhz to 24 mhz min. max. min. max. rd pulse width t rlrh 180 C 6 t clcl C 70 C ns wr pulse width t wlwh 180 C 6 t clcl C 70 C ns address hold after ale t llax2 48 C 2t clcl C 35 C ns rd to valid data in t rldv C 118 C 5 t clcl C 90 ns data hold after rd t rhdx 0C0Cns data float after rd t rhdz C63C 2 t clcl C 20 ns ale to valid data in t lldv C 200 C 8 t clcl C 133 ns address to valid data in t avdv C 220 C 9 t clcl C 155 ns ale to wr or rd t llwl 75 175 3 t clcl C 50 3 t clcl + 50 ns address valid to wr or rd t avwl 67 C 4 t clcl C 97 C ns wr or rd high to ale high t whlh 17 67 t clcl C 25 t clcl + 25 ns data valid to wr transition t qvwx 5C t clcl C 37 C ns data setup before wr t qvwh 170 C 7 t clcl C 122 C ns data hold after wr t whqx 15 C t clcl C 27 C ns address float after rd t rlaz C0C0ns parameter symbol limit values unit variable clock freq. = 1 mhz to 24 mhz min. max. oscillator period t clcl 41.7 1000 ns high time t chcx 12 t clcl C t clcx ns low time t clcx 12 t clcl C t chcx ns rise time t clch C12ns fall time t chcl C12ns
semiconductor group 10-10 device specifications c515 program memory read cycle mct00096 ale psen port 2 lhll t a8 - a15 a8 - a15 a0 - a7 instr.in a0 - a7 port 0 t avll plph t t llpl t lliv t pliv t azpl t llax t pxiz t pxix t aviv t pxav
semiconductor group 10-11 device specifications c515 data memory read cycle mct00097 ale psen port 2 whlh t port 0 rd t lldv t rlrh t llwl t rldv t avll t llax2 t rlaz t avwl t avdv t rhdx t rhdz a0 - a7 from ri or dpl from pcl a0 - a7 instr. in data in a8 - a15 from pch p2.0 - p2.7 or a8 - a15 from dph
semiconductor group 10-12 device specifications c515 data memory write cycle mct00098 ale psen port 2 whlh t port 0 wr t wlwh t llwl t qvwx t avll t llax2 t qvwh t avwl t whqx a0 - a7 from ri or dpl from pcl a0 - a7 instr.in data out a8 - a15 from pch p2.0 - p2.7 or a8 - a15 from dph
semiconductor group 10-13 device specifications c515 clkout timing external clock drive on xtal2 mct00083 ale clk out psen rd,wr t llsh sllh t shsl t slsh t llsh t program memory access data memory access mct00033 t chcx t clcx chcl t clch t v cc t clcl - 0.5v 0.45v cc 0.7 v v - 0.1 cc 0.2
semiconductor group 10-14 device specifications c515 10.6 rom verification characteristics for the c515-1r rom verification mode 1 rom verification mode 1 parameter symbol limit values unit min. max. address to valid data t avqv C 10 t clcl ns mct03212 t avqv new address new data out port 0 inputs : psen = ale, ea = reset = data : address : p1.0 - p1.7 = a0 - a7 v ih il2 v v ss p2.0 - p2.4 = a8 - a12 p0.0 - p0.7 = d0 - d7 p2.0 - p2.4 p1.0 - p1.7 address data out
semiconductor group 10-15 device specifications c515 rom verification mode 2 rom verification mode 2 parameter symbol limit values unit min. typ max. ale pulse width t awd C2 t clcl Cns ale period t acy C 12 t clcl Cns data valid after ale t dva CC4 t clcl ns data stable after ale t dsa 8 t clcl CCns p3.5 setup to ale low t as C t clcl Cns oscillator frequency 1/ t clcl 1C24mhz mct02613 t acy t awd t dsa dva t t as data valid ale port 0 p3.5
semiconductor group 10-16 device specifications c515 ac testing: input, output waveforms ac testing: float waveforms recommended oscillator circuits for crystal oscillator ac inputs during testing are driven at v cc - 0.5 v for a logic 1 and 0.45 v for a logic 0. timing measurements are made at v ihmin for a logic 1 and v ilmax for a logic 0. 0.45 v v cc 0.2 -0.1 +0.9 0.2 cc v test points mct00039 v cc -0.5 v for timing purposes a port pin is no longer floating when a 100 mv change from load voltage occurs and begins to float when a 100 mv change from the loaded v oh / v ol level occurs. i ol / i oh 3 20 ma mct00038 v load v load -0.1 v +0.1 v load v timing reference points v oh -0.1 v +0.1 v ol v mcs03204 xtal1 xtal2 xtal2 xtal1 crystal oscillator mode driving from external source external oscillator signal n.c. 1-24 mhz c c c = 20 pf10 pf (incl. stray capacitance) crystal mode :
semiconductor group 10-17 device specifications c515 10.7 package information (p-lcc-68) gpl05099 0.81 max 1.27 0.43 0.1 0.18 m 68x d a-b 20.32 0.1 5.08 max 3.5 0.2 0.5 min 0.2 1.2 x 45? 23.3 0.3 24.21 0.07 25.28 -0.26 1) 0.38 m d a-b 34x a b d 1 68 0.5 x 45? 3 x 24.21 0.07 1) 25.28 -0.26 1.1 x 45? index marking 1) does not include plastic or metal protrusions of 0.15 max per side plastic package, p-lcc-68 (smd) (plastic lead chip-carrier) sorts of packing package outlines for tubes, trays etc. are contained in our data book package information dimensions in mm smd = surface mounted device
semiconductor group 10-18 device specifications c515 10.8 package information (p-mqfp-80) 0.65 0.3 12.35 0.1 2 2.45 max 1 80 index marking 17.2 14 0.25 min +0.1 0.88 1) 0.6x45? 1) does not include plastic or metal protrusions of 0.25 max per side a-b 0.2 h d 4x a-b 0.2 d 80x a b d c 0.12 80x d a-b m c 1) 14 17.2 -0.05 h 7?max -0.02 +0.08 0.15 0.08 gpm05249 plastic package, p-mqfp-80-1 (smd) (plastic metric quad flat package) sorts of packing package outlines for tubes, trays etc. are contained in our data book package information dimensions in mm smd = surface mounted device
semiconductor group 11-1 index c515 11 index a a/d converter . . . . . . . . . . . . . . . 6-57C6-68 conversion timing . . . . . . . . . . 6-66C6-68 general operation . . . . . . . . . . . . . . 6-57 programmable reference voltages . 6-62C 6-65 registers . . . . . . . . . . . . . . . . . 6-59C6-61 a/d converter characteristics . . . . . . . 10-5 absolute maximum ratings . . . . . . . . . 10-1 ac . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-7 ac characteristics . . . . . . . . . . . 10-6C10-16 16 mhz timing . . . . . . . . . . . . . 10-6C10-7 24 mhz timing . . . . . . . . . . . . . 10-8C10-9 clkout timing . . . . . . . . . . . . . . . 10-13 data memory read cycle . . . . . . . . 10-11 data memory write cycle . . . . . . . . 10-12 external clock timing . . . . . . . . . . . 10-13 program memory read cycle . . . . . 10-10 rom verification mode 1 . . . . . . . . 10-14 rom verification mode 2 . . . . . . . . 10-15 ac testing float waveforms . . . . . . . . . . . . . . 10-16 input/output waveforms . . . . . . . . . 10-16 acc . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-7 adcon . . . . . 3-4, 3-5, 3-7, 5-6, 6-44, 6-59 addat . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-60 adm . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-59 ale signal . . . . . . . . . . . . . . . . . . . . . . . 4-4 b b . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-7 basic cpu timing . . . . . . . . . . . . . . . . . 2-4 bd . . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-44 block diagram . . . . . . . . . . . . . . . . . . . . 2-1 bsy . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-59 c c/t . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-17 ccen . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-28 cch1 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31 cch2 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31 cch3 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31 ccl1 . . . . . . . . . . . . . . . . . . . . . . . 3-4, 6-31 ccl2 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31 ccl3 . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-31 clk . . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 5-6 clkout . . . . . . . . . . . . . . . . . . . . . 3-6, 5-6 cocah0 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28 cocah1 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28 cocah2 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28 cocah3 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28 cocal0 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28 cocal1 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28 cocal2 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28 cocal3 . . . . . . . . . . . . . . . . . . . . 3-7, 6-28 cpu accumulator . . . . . . . . . . . . . . . . . . . .2-2 b register . . . . . . . . . . . . . . . . . . . . . . .2-3 basic timing . . . . . . . . . . . . . . . . . . . . .2-4 fetch/execute diagram . . . . . . . . . . . .2-5 functionality . . . . . . . . . . . . . . . . . . . .2-2 program status word . . . . . . . . . . . . . .2-2 stack pointer . . . . . . . . . . . . . . . . . . . .2-3 cpu timing . . . . . . . . . . . . . . . . . . . . . . .2-5 crch . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-26 crcl . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-26 cy . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-7 d dapr . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-62 dc characteristics . . . . . . . . . . . . 10-2C10-4 device characteristics . . . . . . . . 10-1C10-18 dph . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6 dpl . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6 e eadc . . . . . . . . . . . . . . . . . . 3-6, 6-61 , 7-5 eal . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4 eale . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4 emulation concept . . . . . . . . . . . . . . . . .4-5 es . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4 et0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4 et1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4 et2 . . . . . . . . . . . . . . . . . . . . 3-6, 6-27 , 7-4 ex0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4 ex1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-4 ex2 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5 ex3 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5 ex4 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5 ex5 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5 ex6 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-5 execution of instructions . . . . . . . . . . . . .2-4 exen2 . . . . . . . . . . . . . . . . . 3-6, 6-27 , 7-5 exf2 . . . . . . . . . . . . . . . . . . . 3-7, 6-27 , 7-8 external bus interface . . . . . . . . . . . 4-1C4-4 ale signal . . . . . . . . . . . . . . . . . . . . . .4-4
semiconductor group 11-2 index c515 overlapping of data/program memory 4-3 program memory access . . . . . . . . . . 4-3 program/data memory timing . . . . . . 4-2 psen signal . . . . . . . . . . . . . . . . . . . . 4-3 role of p0 and p2 . . . . . . . . . . . . . . . 4-1 f f0 . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-7 f1 . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-7 fail save mechanisms . . . . . . . . . . . 8-1C8-4 features . . . . . . . . . . . . . . . . . . . . . . . . 1-2 functional units . . . . . . . . . . . . . . . . . . . 1-1 fundamental structure . . . . . . . . . . . . . 2-1 g gate . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-17 gf0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2 gf1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2 h hardware reset . . . . . . . . . . . . . . . . . . . 5-1 i i/o ports . . . . . . . . . . . . . . . . . . . . . 6-1C6-13 i2fr . . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 7-7 i3fr . . . . . . . . . . . . . . . . . . . . 3-7, 6-25 , 7-7 iadc . . . . . . . . . . . . . . . . . . . 3-7, 6-61 , 7-8 idle . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2 idle mode . . . . . . . . . . . . . . . . . . . . . 9-3C9-4 idls . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2 ie0 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-6 ie1 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-6 ien0 . . . . . . . . 3-4, 3-5, 3-6, 6-27, 7-4 , 8-4 ien1 . . . . 3-4, 3-5, 3-6, 6-27, 6-61, 7-5 , 8-4 iex2 . . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 7-8 iex3 . . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 7-8 iex4 . . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 7-8 iex5 . . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 7-8 iex6 . . . . . . . . . . . . . . . . . . . . . 3-7, 7-8, 7-8 int0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 int1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 int2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 int3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 int4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 int5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 int6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 interrupt system . . . . . . . . . . . . . . . 7-1C7-17 interrupts block diagram . . . . . . . . . . . . . . . 7-2C7-3 enable registers . . . . . . . . . . . . . . 7-4C7-5 external interrupts . . . . . . . . . . . . . . .7-15 handling procedure . . . . . . . . . . . . . .7-13 priority registers . . . . . . . . . . . . . . . .7-11 priority within level structure . . . . . . .7-12 request flags . . . . . . . . . . . . . . 7-6C7-10 response time . . . . . . . . . . . . . . . . .7-17 sources and vector addresses . . . . .7-14 ip0 . . . . . . . . . . . . . . . . . 3-5, 3-6, 7-11 , 8-4 ip1 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 7-11 ircon . . . . . . . . . 3-4, 3-7, 6-27, 6-61, 7-8 it0 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-6 it1 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 7-6 l logic symbol . . . . . . . . . . . . . . . . . . . . . .1-3 m m0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-17 m1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-17 memory organization . . . . . . . . . . . 3-1C3-2 data memory . . . . . . . . . . . . . . . . . . . .3-2 general purpose registers . . . . . . . . . .3-2 memory map . . . . . . . . . . . . . . . . . . . .3-1 program memory . . . . . . . . . . . . . . . .3-2 mx0 . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-7 mx1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-7 mx2 . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-7 mx2-0 . . . . . . . . . . . . . . . . . . . . . . . . . .6-59 o oscillator operation . . . . . . . . . . . . . 5-4C5-5 external clock source . . . . . . . . . . . . .5-5 on-chip oscillator circuitry . . . . . . . . . .5-5 recommended oscillator circuit . . . . .5-4 ov . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-7 p p . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-7 p0 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6 p1 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-6 p2 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-6 p3 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-6 p4 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-7 p5 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-7 p6 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 3-7 package information (p-lcc-68) . . . .10-17 package information (p-mqfp-80) . .10-18 parallel i/o . . . . . . . . . . . . . . . . . . 6-1C6-13 pcon . . . . . . . . . . . . . . . 3-5, 3-6, 6-44, 9-2 pde . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2
semiconductor group 11-3 index c515 pds . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2 pin configuration . . . . . . . . . . . . . . . . . . 1-4 p-mqfp-80 package . . . . . . . . . . 1-4, 1-5 pin definitions and functions . . . . . 1-6C1-10 ports . . . . . . . . . . . . . . . . . . . . . . . 6-1C6-13 alternate functions . . . . . . . . . . . . . . . 6-2 loading and interfacing . . . . . . . . . . 6-12 output driver circuitry . . . . . . . . . 6-9C6-10 output/input sample timing . . . . . . . 6-11 read-modify-write operation . . . . . . 6-13 types and structures . . . . . . . . . . . . . 6-1 port 0 circuitry . . . . . . . . . . . . . . . . 6-5 port 1/3/4/5 circuitry . . . . . . . . . . . . 6-6 port 2 circuitry . . . . . . . . . . . . . . . . 6-7 standard i/o port circuitry . . . . 6-3C6-4 power down mode . . . . . . . . . . . . . . . . . 9-6 entry procedure . . . . . . . . . . . . . . . . . 9-6 exit procedure . . . . . . . . . . . . . . . . . . 9-6 power saving modes . . . . . . . . . . . . 9-1C9-7 control register . . . . . . . . . . . . . . . . . 9-2 hardware enable . . . . . . . . . . . . . . . . 9-1 idle mode . . . . . . . . . . . . . . . . . . . 9-3C9-4 power down mode . . . . . . . . . . . . . . . 9-6 slow down mode . . . . . . . . . . . . . . . . 9-5 state of pins . . . . . . . . . . . . . . . . . . . . 9-7 power supply current . . . . . . . . . . 10-3C10-4 psen signal . . . . . . . . . . . . . . . . . . . . . 4-3 psw . . . . . . . . . . . . . . . . . . . . 2-3 , 3-4, 3-7 r rb8 . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43 rd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 recommended oscillator circuits . . . . 10-16 ren . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43 reset . . . . . . . . . . . . . . . . . . . . . . . . 5-1C5-3 hardware reset timing . . . . . . . . . . . . 5-3 reset circuitries . . . . . . . . . . . . . . . . . 5-2 ri . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43 , 7-10 rom protection . . . . . . . . . . . . . . . . 4-6C4-8 protected rom mode . . . . . . . . . . . . 4-7 protected rom verification example . 4-8 protected rom verify timing . . . . . . . 4-7 unprotected rom mode . . . . . . . . . . 4-6 unprotected rom verify timing . . . . . 4-6 rs0 . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-7 rs1 . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-7 rxd . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-41 s sbuf . . . . . . . . . . . . . . . . . . 3-5, 3-6, 6-43 scon . . . . . . . . . . 3-4, 3-5, 3-6, 6-43 , 7-10 sd . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 9-2 serial interface (usart) . . . . . . 6-41C6-56 baudrate generation . . . . . . . . . . . . .6-44 with internal baud rate generator . .6-46 with timer 1 . . . . . . . . . . . . . . . . . .6-46 multiprocessor communication . . . . .6-42 operating mode 0 . . . . . . . . . . 6-48C6-50 operating mode 1 . . . . . . . . . . 6-51C6-53 operating mode 2 and 3 . . . . . 6-54C6-56 registers . . . . . . . . . . . . . . . . . 6-42C6-43 slow down mode . . . . . . . . . . . . . . . . . .9-5 sm0 . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43 sm1 . . . . . . . . . . . . . . . . . . 3-6, 6-43, 6-43 sm2 . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43 smod . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-44 sp . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6 special function registers . . . . . . . . . . .3-3 table - address ordered . . . . . . . 3-6C3-7 table - functional order . . . . . . . . 3-4C3-5 swdt . . . . . . . . . . . . . . . . . . . . . . . 3-6, 8-4 syscon . . . . . . . . . . . . . . . . . 3-4, 3-6, 4-4 system clock output . . . . . . . . . . . . 5-6C5-7 t t0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6 t1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6 t2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6 t2cm . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25 t2con . . . . . . . . . . 3-4, 3-5, 3-7, 6-25 , 7-7 t2ex . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-6 t2i0 . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25 t2i1 . . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25 t2ps . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25 t2r0 . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25 t2r1 . . . . . . . . . . . . . . . . . . . . . . . 3-7, 6-25 tb8 . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43 tcon . . . . . . . . . . . . . . . 3-4, 3-6, 6-16 , 7-6 tf0 . . . . . . . . . . . . . . . . . . . . 3-6, 6-16 , 7-6 tf1 . . . . . . . . . . . . . . . . . . . . 3-6, 6-16 , 7-6 tf2 . . . . . . . . . . . . . . . . . . . . 3-7, 6-27 , 7-8 th0 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-15 th1 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-15 th2 . . . . . . . . . . . . . . . . . . . . 3-4, 3-7, 6-26 ti . . . . . . . . . . . . . . . . . . . . . 3-6, 6-43 , 7-10 timer/counter . . . . . . . . . . . . . . . 6-14C6-40
semiconductor group 11-4 index c515 timer/counter 0 and 1 . . . . . . . 6-14C6-21 mode 0, 13-bit timer/counter . . . . 6-18 mode 1, 16-bit timer/counter . . . . 6-19 mode 2, 8-bit rel. timer/counter . . 6-20 mode 3, two 8-bit timer/counter . . 6-21 registers . . . . . . . . . . . . . . . 6-15C6-17 timer/counter 2 . . . . . . . . . . . . 6-22C6-40 alternate port functions . . . . . . . . 6-22 block diagram . . . . . . . . . . . . . . . 6-23 capture function . . . . . . . . . . 6-39C6-40 compare function . . . . . . . . . 6-31C6-36 compare mode 0 . . . . . . . . . 6-31C6-34 compare mode 1 . . . . . . . . . 6-35C6-36 compare mode interrupts . . . . . . 6-37 general operation . . . . . . . . . . . . 6-29 registers . . . . . . . . . . . . . . . 6-24C6-28 reload mode . . . . . . . . . . . . . . . . 6-30 timings clkout timing . . . . . . . . . . . . . . . 10-13 data memory read cycle . . . . . . . . 10-11 data memory write cycle . . . . . . . . 10-12 external clock timing . . . . . . . . . . . 10-13 program memory read cycle . . . . . 10-10 rom verification mode 1 . . . . . . . . 10-14 rom verification mode 2 . . . . . . . . 10-15 tl0 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-15 tl1 . . . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-15 tl2 . . . . . . . . . . . . . . . . . . . . 3-5, 3-7, 6-26 tmod . . . . . . . . . . . . . . . . . . 3-4, 3-6, 6-17 tr0 . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-16 tr1 . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-16 txd . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 6-41 w watchdog timer . . . . . . . . . . . . . . . . 8-1C8-4 block diagram . . . . . . . . . . . . . . . . . . 8-3 control and status flags . . . . . . . . . . . 8-4 general operation . . . . . . . . . . . . . . . 8-1 refreshing of the wdt . . . . . . . . . . . 8-2 reset operation . . . . . . . . . . . . . . . . . 8-2 starting of the wdt . . . . . . . . . . . . . . 8-1 wdt . . . . . . . . . . . . . . . . . . . . . . . . 3-6, 8-4 wdts . . . . . . . . . . . . . . . . . . . . . . . 3-6, 8-4 wr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
infineon technologies ag - products-~c515 full search home my infineon newsroom contact sitemap products company information investor information careers home > products > microcontrollers > 8-bit microcontrollers > c515 c515 your best choice for a multipurpose microcontroller the c515 is a new derivative of the c500 family of 8-bit- microcontrollers. it is fully compatible to the standard 80c 515/535 family and upgrades it with a slow-down mode, a rom- protection and the enhanced hooks emulation technology&by keeping it fully compatible. the c 515 features a highly flexible 4 channel pwm, a 8-channel 8-bit a/d- converter, a programmable watchdog timer and 6 multifunctional i/o-ports. these features in cooporation with its enhanced emc/rfi improvements and the attractive price performance ratio makes the c515 suitable for a broad range of applications in the industrial, automotive, consumer and telecom segment. c515 8-bit-microcontroller (not for new designs) related systems/applications features: l 500 ns instruction cycle time at 24mhz l 12 interrupt vectors with four priority levels selectable l 8 kbyte on-chip rom memory. rom-protection available l 256 byte on-chip internal ram l supports external address range of up to 64 kbyte program and data memory l three 16-bit timer/counters l 8-channel 8-bit a/d converter l full duplex serial interface with asynchronous and synchronous modes and programmable baudrate generator l extended power saving modes l programmable watchdog timer l 80-pin p-mqfp package l temperature ranges: 0c to + 70c / -40c to + 85c / -40c to + 110c typelist (for details see parameterlist) product type description order info to distributor sab c515-l24n (datasheet) 8-bit cmos microcontroller for external memory (24mhz) not for new design SAF-C515-L24N (datasheet) 8-bit cmos microcontroller for external memory (24mhz) not for new design saf-c515-ln (datasheet) 8-bit cmos microcontroller for external memory (16mhz) not for new design sab-c515-ln (datasheet) 8-bit cmos microcontroller for external memory (16mhz) not for new design sab80c535 8-bit cmos microcontroller for external memory (16mhz) discontinued sab 80c515-n 8-bit cmos microcontroller with mask-programmable rom (12mhz) discontinued sab 80c515-n- t40/85 8-bit cmos microcontroller with mask-programmable rom (12mhz) discontinued additional documentation and information: product family overview description date/state size c515 - product overview (p515.pdf) 04.96 | ok 64 kb datasheet description date/state size sab 80c515 , sab 80c535 - datasheet (d80515.pdf) 02.96 | ok 690 kb user's manual description date/state size c515 - users manual (m515.pdf) 04.98 | ok 800 kb login username: password: forgotten username/ password? not a user yet? search for products advanced parametric discontinued search help! file://///bnsndv31/prod/prod-image/vip_prod/user/source_issue/si_2004/sep/infn/c515.htm (1 of 2) [10/28/2004 4:06:04 pm]
infineon technologies ag - products-~c515 sab 80515,sab 80c535 - users manual (m80515.pdf) 08.95 | ok 2.83 mb errata sheet description date/state size 80c515 cb step (cbr11.pdf) 02.95 | rel. 1.1 17 byte 80c515 da step (dar12.pdf) 03.94 | rel. 1.2 20 byte 80c515 lb step (lbr10.pdf) 11.97 | rel. 1.0 13 byte ? 1999 - 2004 infineon technologies ag - usage of this web site is subject to the usage terms. file://///bnsndv31/prod/prod-image/vip_prod/user/source_issue/si_2004/sep/infn/c515.htm (2 of 2) [10/28/2004 4:06:04 pm]


▲Up To Search▲   

 
Price & Availability of SAF-C515-L24N

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X